Solved installing and updating the src tree with git?

If you don't want to change to /usr/src everytime you update the src tree you could

put this in .cshrc:

alias src-update "( cd /usr/src; sudo git pull ) ;"

or this in .shrc

alias src-update="( cd /usr/src; sudo git pull ) ;"

====

The fish shell didn't like this sort of syntax, so I had to use this in ~/.config/fish/config.fish:

alias src-update 'set var $PWD ; cd /usr/src/ ; sudo git pull ; cd $var'

It may prompt for a password or not depending upon the sudoers file.

====

...or a perl script:

Code:
#!/usr/local/bin/perl -w

#------------------------------------------#
# PROGRAM: src-update                      #
#------------------------------------------#

$dir="/usr/src";
$var="sudo git pull";

chdir( $dir ) or die "Couldn't go inside $dir directory, $!";

system("$var");
 
Last edited:
sudo -D /usr/src git pull ;)

Code:
     -D directory, --chdir=directory
                 Run the command in the specified directory instead of the
                 current working directory.  The security policy may return an
                 error if the user does not have permission to specify the
                 working directory.
 
Thank you for the background, with that the move makes total sense to me. Also thanks for the pointers to git-lite and git-tiny!
 
Have a look at net/gitup.
Installing gitup-0.89...
Currently this program is beta, so the usual caveats/warnings (don't
use it in a production environment, make sure you've got backups, dont
(yet) run as root) apply.
it is not clear how to use it.
Code:
gitup  clone -b releng/12.2 --depth 1 [URL]https://git.freebsd.org/src.git[/URL] src
gitup:
Cannot find a matching section in the command line arguments.  These are the configured sections:
     * ports
     * quarterly
     * release
     * stable
     * current
: Invalid argument
 
It's not a replacement for git, so I suggest you read it's man page.
 
If nobody tries it then bugs and issues won't be found and fixed and thus will never reach production status either.
 
And it's actually really easy to use. Just modify /usr/local/etc/gitup.conf so you get the correct version and do gitup release for example. Done. No complicated git commands required.
 
From where I'm at now, gitup is very close to a 1.0 release. To use a car analogy, the engine and drive train are solid and all the remaining work is on things like the dashboard, exhaust system, seat belts, etc.

If anyone has thoughts on how I can refine or improve it, please let me know!
 
Please tell me how to change the branch from releng / 12.1 to releng / 12.2?

Since src now contains files from the svn repository, git checkout releng / 12.2 cannot be executed.
And git clone cannot be executed in a non-empty directive either.
I will do rm -rf / usr / src / *
And after git clone
 
cloning a branch
# git clone -b releng/12.1 --depth 1 https://git.freebsd.org/src.git src
changing the branch
Code:
# git pull origin releng/12.2
подсказка: Pulling without specifying how to reconcile divergent branches is
подсказка: discouraged. You can squelch this message by running one of the following
подсказка: commands sometime before your next pull:
подсказка: 
подсказка:   git config pull.rebase false  # merge (the default strategy)
подсказка:   git config pull.rebase true   # rebase
подсказка:   git config pull.ff only       # fast-forward only
подсказка: 
подсказка: You can replace "git config" with "git config --global" to set a default
подсказка: preference for all repositories. You can also pass --rebase, --no-rebase,
подсказка: or --ff-only on the command line to override the configured default per
подсказка: invocation.
Из [URL]https://git.freebsd.org/src[/URL]
 * branch                    releng/12.2 -> FETCH_HEAD
fatal: отказ слияния несвязанных историй изменений
Code:
# git branch --all
* releng/12.1
  remotes/origin/releng/12.1

# git fetch origin releng/12.2
Из [URL]https://git.freebsd.org/src[/URL]
 * branch                    releng/12.2 -> FETCH_HEAD

 # git branch --all
* releng/12.1
  remotes/origin/releng/12.1
What am I doing wrong?
 
git checkout releng/12.2
Code:
# git checkout releng/12.2
error: pathspec 'releng/12.2' did not match any file(s) known to git

Where to get this branch if it does not exist.
# git branch --all
* releng/12.1
  remotes/origin/releng/12.1
 
git pull && git checkout releng/12.2
Code:
 * [новая метка]               vendor/zstd/1.3.0                                                   -> vendor/zstd/1.3.0
 * [новая метка]               vendor/zstd/1.3.1                                                   -> vendor/zstd/1.3.1
 * [новая метка]               vendor/zstd/1.3.2                                                   -> vendor/zstd/1.3.2
Уже обновлено.
error: pathspec 'releng/12.2' did not match any file(s) known to git

# git branch --all
* releng/12.1
  remotes/origin/releng/12.1
 
Why do I need gitup, I already installed git!

I understand how it will not be possible to switch to another branch before
svn switch svn://svn.freebsd.org/base/releng/12.2 /usr/src
git checkout releng/12.2
Does not work.

there is only one way out.
rm -rf /usr/src/*

Now doing.
git clone -b releng/12.2 --depth 1 https://git.freebsd.org/src.git src
 
Back
Top