Skip to contentSkip to conversation

git-quiltimport: add a --series option

PATCH New Wang Nan 1 participant 1 message Dec 20, 2013 Documentation

lore
Share & tools
lore

Wang Nan

author
#0 lore raw

PATCH 1/1 git-quiltimport: add a --series option

This patch add a --series option to git-quiltimport to allow users to select the name of series file. This option is an analog of quilt's QUILT_SERIES environment variable.

---
 Documentation/git-quiltimport.txt |  5 +++++
 git-quiltimport.sh                | 21 ++++++++++++++++++++-
 2 files changed, 25 insertions(+), 1 deletion(-)
Documentation/git-quiltimport.txt +5 -0
index a356196..39d8e4b 100644
@@ -44,6 +44,11 @@ OPTIONS
 --patches <dir>::
 	The directory to find the quilt patches and the
 	quilt series file.
+
+--series <file>::
+	The name of the series file, defaulting to "series". Relative to
+	patches directory unless an absolute path is used.
+
 +
 The default for the patch directory is patches
 or the value of the $QUILT_PATCHES environment
git-quiltimport.sh +20 -1
index 8e17525..11a97b4 100755
@@ -6,6 +6,7 @@ git quiltimport [options]
 n,dry-run     dry run
 author=       author name and email address for patches without any
 patches=      path to the quilt series and patches
+series=       name of the series file
 "
 SUBDIRECTORY_ON=Yes
 . git-sh-setup
@@ -26,6 +27,10 @@ do
 		shift
 		QUILT_PATCHES="$1"
 		;;
+	--series)
+		shift
+		QUILT_SERIES="$1"
+		;;
 	--)
 		shift
 		break;;
@@ -52,6 +57,20 @@ if ! [ -d "$QUILT_PATCHES" ] ; then
 	exit 1
 fi
 
+: ${QUILT_SERIES:=series}
+case ${QUILT_SERIES} in
+	/*)
+		QUILT_SERIES_FILE=${QUILT_SERIES}
+	   ;;
+	*)
+		QUILT_SERIES_FILE=${QUILT_PATCHES}/${QUILT_SERIES}
+esac
+
+if ! [ -f "$QUILT_SERIES_FILE" ] ; then
+	echo "The \"$QUILT_SERIES_FILE\" file does not exist."
+	exit 1
+fi
+
 # Temporary directories
 tmp_dir="$GIT_DIR"/rebase-apply
 tmp_msg="$tmp_dir/msg"
@@ -134,5 +153,5 @@ do
 		commit=$( (echo "$SUBJECT"; echo; cat "$tmp_msg") | git commit-tree $tree -p $commit) &&
 		git update-ref -m "quiltimport: $patch_name" HEAD $commit || exit 4
 	fi
-done 3<"$QUILT_PATCHES/series"
+done 3<"$QUILT_SERIES_FILE"
 rm -rf $tmp_dir || exit 5
Signature · 1 line
1.8.4