On 26 September 2018 03:10:17 GMT+05:30, Junio C Hamano <gitster@xxxxxxxxx> wrote: > > That looks like fetching only the 'next' branch and nothing else to > me. > Interesting. > Perhaps your script is referring to a variable whose assignment is > misspelled and invoking > > git fetch $origin $branch > > and you are expecting the $branch variable to have string 'next' but > due to some bugs it is empty somehow? That explains why sometimes > (i.e. when $branch does not get the value you expect it to have) the > script fetches everything and some other times (i.e. when $branch > does get the right value) the script fetches only the named branch. Noce guees but I should have made this clear. The weirdness I described in my initial mail happens when I run "git fetch origin next" manually in the terminal. The script only helped me identity that there was an issue as it was automatically building the wrong version of Git. It was building and installing the current 'origin/maint' when I wrote it for building origin/next. I could easily identify the difference as 'origin/maint' was at v2.18 while 'origin/next' was at v2.19 when I notived this issue. Also the script doesn't depend on any variables for the branch name. I've hardcoded the 'next' branch into it. For the sake of reference, I've attached the script inline at the end of this mail. Note that I've sanitized the path in which the worktree exists as $COMMON_ROOT. I did not notice this weirdness in another PC. But, this happens in all the worktrees other than the main worktree in my laptop. I'm not sure what I'm doing weirdly that might have caused this issue. I'm not sure whether I mentioned this before I'm currently using a manually built version of Git. It was built from origin/next pointing at 01d371f741. But this also happens in Git v2.18.0 that comes via the pacakge manager of my operating system (Debian testing). -- Sivaraam #!/bin/sh # # A script for the cron job that automatically fetches # updates for the 'next' branch of Git and builds and # installs the binary from source. # # The build succeeds only if the config.mak is present # in the directory with appropriate configuration. # # The binary is installed into the default location if # a prefix is not specified in the config.mak file. # Bringing the binary into use is in the hands of the user. # Hint: A bash alias might help. GIT_NEXT_BUILD_AUTOMATE_DIR='$COMMON_ROOT/git-next-build-automate' LOG_FILE="$GIT_NEXT_BUILD_AUTOMATE_DIR/GIT-NEXT-INSTALLATION-LOG.txt" LOG_MSG_COMMON="installation of git 'next' build on $(date)" if cd "$GIT_NEXT_BUILD_AUTOMATE_DIR" then # Fetch the remote changes if git fetch origin next && git checkout -f FETCH_HEAD then if make install then GIT_NEXT_BUILD_STATUS=0 else GIT_NEXT_BUILD_STATUS=1 fi else GIT_NEXT_BUILD_STATUS=1 fi else GIT_NEXT_BUILD_STATUS=1 fi if test $GIT_NEXT_BUILD_STATUS -eq 0 then echo "SUCCESS: $LOG_MSG_COMMON" >>"$LOG_FILE" else echo "FAILURE: $LOG_MSG_COMMON" >>"$LOG_FILE" fi