Re: [PATCH (2nd try)] Add git-stash script

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

 



 しらいしななこ <nanako3@xxxxxxxxxxxxxx> writes:

> Unfortunately I haven't managed to get the suggestion to use
> "export GITHEAD_xxxx=NicerName" from Johannes Schindelin working
> yet.

I'd drop hints below, but first...

>  git-stash.sh |  153 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
>  1 files changed, 153 insertions(+), 0 deletions(-)
>  create mode 100755 git-stash.sh

... we would want an entry in .gitignore and Makefile as well ;-)

> diff --git a/git-stash.sh b/git-stash.sh
> new file mode 100755
> index 0000000..8bf83c1
> --- /dev/null
> +++ b/git-stash.sh
> ...
> +apply_stash () {
> +	git-diff-files --quiet ||
> +		die 'Cannot restore on top of a dirty state'
> +
> +	# current index state
> +	c_tree=$(git-write-tree) ||
> +		die 'Cannot apply a stash in the middle of a merge'
> +
> +	s=$(git-rev-parse --revs-only --no-flags --default $ref_stash "$@") &&
> +	w_tree=$(git-rev-parse --verify "$s:") &&
> +	b_tree=$(git-rev-parse --verify "$s^:") ||
> +		die "$*: no valid stashed state found"

At this point, you would say:

	eval "
		GITHEAD_$w_tree='Stashed changes' &&
                GITHEAD_$c_tree='Updated upstream' &&
                GITHEAD_$b_tree='Version stash was based on'
	" &&
	export GITHEAD_$w_tree GITHEAD_$c_tree GITHEAD_$b_tree

I suspect you did not use eval and got syntax errors from
variable assignment from the shell?

	VAR_$iable='Assign ment'

is a syntax error, while

	export VAR_$iable

is not.  Don't ask me why.

-
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]

  Powered by Linux