* [PATCH] cg-seek should not complain if run twice
@ 2005-12-20 4:55 Pavel Roskin
2006-01-14 23:30 ` Petr Baudis
0 siblings, 1 reply; 4+ messages in thread
From: Pavel Roskin @ 2005-12-20 4:55 UTC (permalink / raw)
To: Petr Baudis; +Cc: git
cg-seek complains if run without arguments in a non-seeked repository:
rm: cannot remove `.git/refs/heads/cg-seek-point': No such file or directory
rm: cannot remove `.git/head-name': No such file or directory
In fact, it's OK for those files not to exist, so they should be removed
silently.
Signed-off-by: Pavel Roskin <proski@gnu.org>
diff --git a/cg-seek b/cg-seek
index 942267f..8356593 100755
--- a/cg-seek
+++ b/cg-seek
@@ -60,7 +60,7 @@ if [ "$seek_mode" = "away" ]; then
git-symbolic-ref HEAD "refs/heads/cg-seek-point"
else
git-symbolic-ref HEAD "refs/heads/$_git_head"
- rm "$_git/refs/heads/cg-seek-point" "$_git/head-name"
+ rm -f "$_git/refs/heads/cg-seek-point" "$_git/head-name"
rm -f "$_git/blocked"
fi
--
Regards,
Pavel Roskin
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] cg-seek should not complain if run twice
2005-12-20 4:55 [PATCH] cg-seek should not complain if run twice Pavel Roskin
@ 2006-01-14 23:30 ` Petr Baudis
2006-01-15 6:03 ` Pavel Roskin
0 siblings, 1 reply; 4+ messages in thread
From: Petr Baudis @ 2006-01-14 23:30 UTC (permalink / raw)
To: Pavel Roskin; +Cc: git
Dear diary, on Tue, Dec 20, 2005 at 05:55:36AM CET, I got a letter
where Pavel Roskin <proski@gnu.org> said that...
> cg-seek complains if run without arguments in a non-seeked repository:
>
> rm: cannot remove `.git/refs/heads/cg-seek-point': No such file or directory
> rm: cannot remove `.git/head-name': No such file or directory
>
> In fact, it's OK for those files not to exist, so they should be removed
> silently.
>
> Signed-off-by: Pavel Roskin <proski@gnu.org>
It seems cleaner to just make cg-seek fail with a sensible error message
if it's already unseeked.
--
Petr "Pasky" Baudis
Stuff: http://pasky.or.cz/
Of the 3 great composers Mozart tells us what it's like to be human,
Beethoven tells us what it's like to be Beethoven and Bach tells us
what it's like to be the universe. -- Douglas Adams
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] cg-seek should not complain if run twice
2006-01-14 23:30 ` Petr Baudis
@ 2006-01-15 6:03 ` Pavel Roskin
2006-01-15 23:59 ` Petr Baudis
0 siblings, 1 reply; 4+ messages in thread
From: Pavel Roskin @ 2006-01-15 6:03 UTC (permalink / raw)
To: Petr Baudis; +Cc: git
Hello, Petr!
Quoting Petr Baudis <pasky@suse.cz>:
> It seems cleaner to just make cg-seek fail with a sensible error message
> if it's already unseeked.
I don't like this. What if "cvs up -A" would fail if run twice? What if
cg-clean would fail if there was nothing to clean? What if sync would fail if
it didn't cause a single disk write? Idempotent operations are easier to work
with. Please see http://en.wikipedia.org/wiki/Idempotent_(software)
I could make an exception for the case when the command invocation indicates
that the user is unaware of something, and that it would endanger the user's
data. But it's not the case for cg-seek without arguments on non-seeked
repository. The intention is clear, and the knowledge of the current state of
the repository doesn't matter, since there will be no merge or something.
--
Regards,
Pavel Roskin
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] cg-seek should not complain if run twice
2006-01-15 6:03 ` Pavel Roskin
@ 2006-01-15 23:59 ` Petr Baudis
0 siblings, 0 replies; 4+ messages in thread
From: Petr Baudis @ 2006-01-15 23:59 UTC (permalink / raw)
To: Pavel Roskin; +Cc: git
Hello,
Dear diary, on Sun, Jan 15, 2006 at 07:03:35AM CET, I got a letter
where Pavel Roskin <proski@gnu.org> said that...
> Quoting Petr Baudis <pasky@suse.cz>:
>
> > It seems cleaner to just make cg-seek fail with a sensible error message
> > if it's already unseeked.
>
> I don't like this. What if "cvs up -A" would fail if run twice? What if
> cg-clean would fail if there was nothing to clean? What if sync would fail if
> it didn't cause a single disk write? Idempotent operations are easier to work
> with. Please see http://en.wikipedia.org/wiki/Idempotent_(software)
>
> I could make an exception for the case when the command invocation indicates
> that the user is unaware of something, and that it would endanger the user's
> data. But it's not the case for cg-seek without arguments on non-seeked
> repository. The intention is clear, and the knowledge of the current state of
> the repository doesn't matter, since there will be no merge or something.
I have my reservations to this argumentation in the specific cg-seek
case, but it's very subjective, unclear, and I personally really don't
care. So let it be your way. ;-)
Thanks for your opinion,
--
Petr "Pasky" Baudis
Stuff: http://pasky.or.cz/
Of the 3 great composers Mozart tells us what it's like to be human,
Beethoven tells us what it's like to be Beethoven and Bach tells us
what it's like to be the universe. -- Douglas Adams
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2006-01-15 23:58 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-12-20 4:55 [PATCH] cg-seek should not complain if run twice Pavel Roskin
2006-01-14 23:30 ` Petr Baudis
2006-01-15 6:03 ` Pavel Roskin
2006-01-15 23:59 ` Petr Baudis
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).