Skip to contentSkip to conversation

revision: add --except option

PATCH New Felipe Contreras 1 participant 1 message Jun 15, 2016 Documentation

lore
Share & tools
lore
#0 lore raw

PATCH v3 1/1 revision: add --except option

So that it's possible to remove certain refs from the list without removing the objects that are referenced by other refs.

For example this repository:

C (crap)
B (test)
A (HEAD, master)

When using '--branches --except crap':

B (test)
A (HEAD, master)

But when using '--branches --not crap' nothing will come out.

---
 Documentation/git-rev-parse.txt        |  6 +++
 contrib/completion/git-completion.bash |  2 +-
 revision.c                             | 54 +++++++++++++++++++++++-
 revision.h                             |  3 +-
 t/t6112-rev-list-except.sh             | 77 ++++++++++++++++++++++++++++++++++
 5 files changed, 139 insertions(+), 3 deletions(-)
 create mode 100755 t/t6112-rev-list-except.sh
Documentation/git-rev-parse.txt +6 -0
index 2b126c0..fe5cc6b 100644
@@ -110,6 +110,12 @@ can be used.
 	strip '{caret}' prefix from the object names that already have
 	one.
 
+--except::
+	Skip the following object names. For example:
+	'--branches --except master' will show all the branches, except master.
+	This differs from --not in that --except will still show the object, if
+	they are referenced by another object name.
+
 --symbolic::
 	Usually the object names are output in SHA-1 form (with
 	possible '{caret}' prefix); this option makes them output in a
contrib/completion/git-completion.bash +1 -1
index 5da920e..aed8c12 100644
@@ -1386,7 +1386,7 @@ _git_ls_tree ()
 
 # Options that go well for log, shortlog and gitk
 __git_log_common_options="
-	--not --all
+	--not --except --all
 	--branches --tags --remotes
 	--first-parent --merges --no-merges
 	--max-count=
revision.c +53 -1

83 lines not on this page · raw message

revision.h +2 -1
index 95859ba..89f5037 100644
@@ -17,7 +17,8 @@
 #define SYMMETRIC_LEFT	(1u<<8)
 #define PATCHSAME	(1u<<9)
 #define BOTTOM		(1u<<10)
-#define ALL_REV_FLAGS	((1u<<11)-1)
+#define SKIP		(1u<<11)
+#define ALL_REV_FLAGS	((1u<<12)-1)
 
 #define DECORATE_SHORT_REFS	1
 #define DECORATE_FULL_REFS	2
t/t6112-rev-list-except.sh new file +77 -0

77 lines not on this page · raw message

Signature · 1 line
1.8.4-fc