Re: [PATCH] git-{parse-remote,pull}: throw away stderr of git-symbolic-ref

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Jeff King <peff@xxxxxxxx> writes:

> We look up the destination of the HEAD symref in order to get the
> default remote and merge head for the current branch. However, if we
> have a detached HEAD, there is no current branch. We handle this
> situation by looking up branch..remote, which is empty.
> Unfortunately, git-symbolic-ref complained to stderr, potentially
> scaring users.

I think what I sent out was a moral equivalent, but generally
speaking I do not think we should discard stderr output
indiscriminatingly.

> diff --git a/git-pull.sh b/git-pull.sh
> index 9592617..f0cc023 100755
> --- a/git-pull.sh
> +++ b/git-pull.sh
> @@ -83,7 +83,7 @@ merge_head=$(sed -e '/	not-for-merge	/d' \
>  
>  case "$merge_head" in
>  '')
> -	curr_branch=$(git-symbolic-ref HEAD | \
> +	curr_branch=$(git-symbolic-ref HEAD 2>/dev/null | \
>  		sed -e 's|^refs/heads/||')
>  	echo >&2 "Warning: No merge candidate found because value of config option
>           \"branch.${curr_branch}.merge\" does not match any remote branch fetched."

I missed this one, but I think this needs a bit more through
rework.  This is what happens when you say "git pull origin"
while your HEAD is detached, and specifying "branch..merge" in
the configuration should not be the way to define the default
remote branch to be merged while on a detached HEAD.  In fact, I
think there should not be any such default.

I think it makes more sense to say "your HEAD is detached and
you need to explicitly say which branch you would want to merge
in" in this case.

-
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]