git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Kaartic Sivaraam <kaartic.sivaraam@gmail.com>
To: Junio C Hamano <gitster@pobox.com>
Cc: Duy Nguyen <pclouds@gmail.com>, Git Mailing List <git@vger.kernel.org>
Subject: Re: git fetch <remote> <branch> behaves weirdely when run in a worktree
Date: Wed, 26 Sep 2018 09:07:49 +0530	[thread overview]
Message-ID: <37cf330b7d26241cd770de1c03961d4a88006293.camel@gmail.com> (raw)
In-Reply-To: <xmqqpnx1ntmm.fsf@gitster-ct.c.googlers.com>

On 26 September 2018 03:10:17 GMT+05:30, Junio C Hamano <gitster@pobox.com> 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


  reply	other threads:[~2018-09-26  3:37 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-09-23 20:09 git fetch <remote> <branch> behaves weirdely when run in a worktree Kaartic Sivaraam
2018-09-24 15:17 ` Duy Nguyen
2018-09-25 18:44   ` Kaartic Sivaraam
2018-09-25 21:40     ` Junio C Hamano
2018-09-26  3:37       ` Kaartic Sivaraam [this message]
2018-09-26  4:46 ` Kaartic Sivaraam
2018-09-26 15:24   ` Duy Nguyen
2018-09-26 16:09     ` Duy Nguyen
2018-09-26 17:05       ` Junio C Hamano
2018-10-02 18:43         ` Kaartic Sivaraam
2018-10-04  6:54           ` Kaartic Sivaraam
2018-10-04  7:00             ` Duy Nguyen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=37cf330b7d26241cd770de1c03961d4a88006293.camel@gmail.com \
    --to=kaartic.sivaraam@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=pclouds@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).