[Ksummit-discuss] [ANNOUNCE] git-series: track changes to a patch series over time

James Hogan james.hogan at imgtec.com
Mon Aug 15 12:53:09 UTC 2016


Hi Josh,

On Fri, Jul 29, 2016 at 12:50:39AM -0700, Josh Triplett wrote:
> I'd welcome any feedback, whether on the interface and workflow, the
> internals and collaboration, ideas on presenting diffs of patch series,
> or anything else.

I often have patch series which are dependent on one another. It is then
very useful to be able to see all the branch names in logs (i.e. with
--decorate or using tig). This isn't possible out of the box with
git-series however since it seems to prefer to work on a detached head.

I sort of worked around this with a hacky script (see below) to update
my branches (which start with e.g. "4.8/") to point to the corresponding
git series latest commit.

Do you think it'd be practical and make sense for git-series to learn to
(optionally?) automatically remain on a particular branch (in my case
with the same name as the series) and keep it updated with rebases etc?
I realise the semantics of how it might work may be a little unclear at
the moment since the SHEAD doesn't get updated until git series commit.

Cheers
James

#!/bin/bash

V=4.8
if [ -n "$1" ]; then
	V=$(echo "$1" | sed 's/^v//')
fi

set -e

branches=$(git branch | grep -v 'detached from' | sed 's/^. //g')
for b in $(git series | grep '^. '$V'\/.*$' | sed 's/^. //g'); do
	if echo "$branches" | fgrep -qx "$b"; then
		brev=$(git rev-parse "$b")
		ref=$(echo $b | sed 's/^\(.*\)$/git-series\/\1^2/g')
		refrev=$(git rev-parse --verify --quiet "$ref" 2>&1 || true)
		if [ -z "$refrev" ]; then
			ref=$(echo $b | sed 's/^\(.*\)$/git-series\/\1^/g')
			refrev=$(git rev-parse --verify --quiet "$ref" 2>&1 || true)
			if [ -z "$refrev" ]; then
				continue
			fi
		fi
		if [ "$brev" != "$refrev" ]; then
			echo "Moving $b $brev...$refrev ($ref)"
			echo "  git branch -D \"$b\""
			echo "  git branch \"$b\" \"$ref\""
			echo -n "Go ahead [Y|n]? "
			read yes
			if [ "$yes" == "y" ]; then
				git branch -D "$b"
				git branch "$b" "$ref"
				echo "  done"
			fi
		fi
	fi
done
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.linuxfoundation.org/pipermail/ksummit-discuss/attachments/20160815/9c7bee03/attachment.sig>


More information about the Ksummit-discuss mailing list