Re: [PATCH] Make git-{pull,rebase} message without tracking information friendlier

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

 



Carlos Martín Nieto <cmn@xxxxxxxx> writes:

> The current message is too long and at too low a level for anybody to
> understand it if they don't know about the configuration format
> already.
>
> The text about setting up a remote is superfluous and doesn't help
> understand the error that has happened. Explain how to set up the
> tracking information, as it's the most likely way to get to the state
> the user was expecting.
>
> Also simplify the message we print on detached HEAD to remove clutter
> and a reference to branch.<branchname>.merge which is better left for
> the documentation.
> ---
> This still needs some shell scripting to figure out whether we'd want
> to replace <remote> with a real value. The text gets to the matter of
> things and even tells you how to fix it. More text doesn't really add
> more useful information, and this isn't a manpage.

Exactly.

This made me thinking again.  On the "detached HEAD" side of your patch,
the concluding "Please specify which branch you mean" is the most useful
information; ", so I cannot use any tracking information in your
configuration file" may help _education_, but does not immediately help
the user to do what the user wanted to do.

Perhaps it may read it better if we remove that part; the result becomes
even more concise and to the point.

Oh the "on a branch" side of your patch, the updated message is trying to
help the user by doing two things:

 - tell him to explicitly name the branch (by the way, you seem to have
   lost the $example---is it intended) in order to immediately perform
   what he wanted to.

 - educate him that he can configure upstream information and avoid
   typing in a later invocation of the same command.

I think it is easier to read if we have clear separation between the two,
as the hasty users would want to stop reading after the first help.

So after "See git-${cmd}(1) for details.", have a paragraph break, add
an indented "$example" just like you have for the "detached HEAD" case,
another paragraph break and then "To set the tracking information" as a
new pargraph, perhaps?

> I've left the branch --set-upstream in this version as it's probably
> the most usual fix for a failing git push.
>
>  git-parse-remote.sh |   32 ++++++++++----------------------
>  git-pull.sh         |    2 +-
>  git-rebase.sh       |    2 +-
>  3 files changed, 12 insertions(+), 24 deletions(-)
>
> diff --git a/git-parse-remote.sh b/git-parse-remote.sh
> index b24119d..08adc90 100644
> --- a/git-parse-remote.sh
> +++ b/git-parse-remote.sh
> @@ -60,31 +60,19 @@ error_on_missing_default_upstream () {
>  	if test -z "$branch_name"
>  	then
>  		echo "You are not currently on a branch, so I cannot use any
> +tracking information in your configuration file.
> +Please specify which branch you want to $op_type $op_prep.
>  See git-${cmd}(1) for details.
>  
> +    $example"
> +	else
> +		echo "You asked me to $cmd without specifying a branch to
> +$op_type $op_prep, and the current branch doesn't have any tracking
> +information. Please specify a branch and try again. See git-${cmd}(1)
> +for details. To set the tracking information, you can use
>  
> -See git-config(1) for details."
> +    git branch --set-upstream ${branch_name#refs/heads/} <remote>/<branch>
> +"
>  	fi
>  	exit 1
>  }
> diff --git a/git-pull.sh b/git-pull.sh
> index d8b64d7..309c7db 100755
> --- a/git-pull.sh
> +++ b/git-pull.sh
> @@ -176,7 +176,7 @@ error_on_no_merge_candidates () {
>  	elif [ -z "$curr_branch" -o -z "$upstream" ]; then
>  		. git-parse-remote
>  		error_on_missing_default_upstream "pull" $op_type $op_prep \
> -			"git pull <repository> <refspec>"
> +			"git pull <remote> <branch>"
>  	else
>  		echo "Your configuration specifies to $op_type $op_prep the ref '${upstream#refs/heads/}'"
>  		echo "from the remote, but no such ref was fetched."
> diff --git a/git-rebase.sh b/git-rebase.sh
> index 00ca7b9..69c1374 100755
> --- a/git-rebase.sh
> +++ b/git-rebase.sh
> @@ -380,7 +380,7 @@ then
>  		then
>  			. git-parse-remote
>  			error_on_missing_default_upstream "rebase" "rebase" \
> -				"against" "git rebase <upstream branch>"
> +				"against" "git rebase <branch>"
>  		fi
>  		;;
>  	*)	upstream_name="$1"
--
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]