# [PATCH] Fix cg-admin-uncommit

2 messages from 2005-09-30 to 2005-10-11. Participants: Paolo 'Blaisorblade' Giarrusso, Petr Baudis.
Thread: https://gitlist.dev/t/1986

## Paolo 'Blaisorblade' Giarrusso, 2005-09-30 18:35

Subject: [PATCH] Fix cg-admin-uncommit
Message-ID: <20050930183545.15895.61691.stgit@zion.home.lan>
URL: https://gitlist.dev/e/20050930183545.15895.61691.stgit%40zion.home.lan

```
From: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>

It uses $1 rather than ${ARGS[0]}, which breaks when optparse found some
options, i.e. with cg-admin-uncommit -t (cg-object-id -c -t is not nice).

Please, document optparse to explain this. It's absolutely non-obvious, and when
I first hit this I thought optparse was buggy but couldn't make my way to the
fix.

Both because I was using cogito rather than debugging it, and even considering
the obfuscation level, but above all I was looking for a call to shift in
optshift and didn't find it. Now I understood the thing I pity myself, though.

Btw, why doesn't optparse consume all the cmd arguments via shift, making thus
sure that $1 never works at all?

Signed-off-by: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
---

 cg-admin-uncommit |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/cg-admin-uncommit b/cg-admin-uncommit
--- a/cg-admin-uncommit
+++ b/cg-admin-uncommit
@@ -47,7 +47,7 @@ done
 
 base=$(cg-object-id -c) || exit 1
 
-commit=$(cg-object-id -c "$1") || exit 1
+commit=$(cg-object-id -c "${ARGS[0]}") || exit 1
 git-rev-list $base | grep -q $commit || \
 	die "$commit: not an ancestor of HEAD"
 

```

## Petr Baudis, 2005-10-11 23:16

Subject: Re: [PATCH] Fix cg-admin-uncommit
Message-ID: <20051011231617.GG30889@pasky.or.cz>
URL: https://gitlist.dev/e/20051011231617.GG30889%40pasky.or.cz
In-Reply-To: <20050930183545.15895.61691.stgit@zion.home.lan>

```
Dear diary, on Fri, Sep 30, 2005 at 08:35:46PM CEST, I got a letter
where Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it> told me that...
> Btw, why doesn't optparse consume all the cmd arguments via shift, making thus
> sure that $1 never works at all?

I did something hopefully equivalent, thanks for the idea (and for the
patch as well :-).

-- 
				Petr "Pasky" Baudis
Stuff: http://pasky.or.cz/
VI has two modes: the one in which it beeps and the one in which
it doesn't.

```
