git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] checkout without arguments does not make sense
@ 2008-07-21 20:06 Johannes Sixt
  2008-07-21 20:49 ` Miklos Vajna
  0 siblings, 1 reply; 6+ messages in thread
From: Johannes Sixt @ 2008-07-21 20:06 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git

Signed-off-by: Johannes Sixt <johannes.sixt@telecom.at>
---
 builtin-checkout.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/builtin-checkout.c b/builtin-checkout.c
index fbd5105..669be0e 100644
--- a/builtin-checkout.c
+++ b/builtin-checkout.c
@@ -487,7 +487,8 @@ int cmd_checkout(int argc, const char **argv, const char *prefix)
 		}
 
 		return checkout_paths(source_tree, pathspec);
-	}
+	} else if (!new.name && !opts.new_branch)
+		usage_with_options(checkout_usage, options);
 
 	if (new.name && !new.commit) {
 		die("Cannot switch branch to a non-commit.");
-- 
1.6.0.rc0.18.g6aef2

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH] checkout without arguments does not make sense
  2008-07-21 20:06 [PATCH] checkout without arguments does not make sense Johannes Sixt
@ 2008-07-21 20:49 ` Miklos Vajna
  2008-07-21 21:11   ` Johannes Sixt
  2008-07-21 21:36   ` Avery Pennarun
  0 siblings, 2 replies; 6+ messages in thread
From: Miklos Vajna @ 2008-07-21 20:49 UTC (permalink / raw)
  To: Johannes Sixt; +Cc: Junio C Hamano, git

[-- Attachment #1: Type: text/plain, Size: 665 bytes --]

On Mon, Jul 21, 2008 at 10:06:32PM +0200, Johannes Sixt <johannes.sixt@telecom.at> wrote:
> @@ -487,7 +487,8 @@ int cmd_checkout(int argc, const char **argv, const char *prefix)
>  		}
>  
>  		return checkout_paths(source_tree, pathspec);
> -	}
> +	} else if (!new.name && !opts.new_branch)
> +		usage_with_options(checkout_usage, options);
>  
>  	if (new.name && !new.commit) {
>  		die("Cannot switch branch to a non-commit.");

Actually I think it _is_ useful, like this:

$ git checkout
Your branch is ahead of the tracked remote branch 'junio/next' by 1 commit.

How will it be possible to get that info easily after your patch?

Thanks.

[-- Attachment #2: Type: application/pgp-signature, Size: 197 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] checkout without arguments does not make sense
  2008-07-21 20:49 ` Miklos Vajna
@ 2008-07-21 21:11   ` Johannes Sixt
  2008-07-21 21:36   ` Avery Pennarun
  1 sibling, 0 replies; 6+ messages in thread
From: Johannes Sixt @ 2008-07-21 21:11 UTC (permalink / raw)
  To: Miklos Vajna; +Cc: git, Junio C Hamano

On Montag, 21. Juli 2008, Miklos Vajna wrote:
> Actually I think it _is_ useful, like this:
>
> $ git checkout
> Your branch is ahead of the tracked remote branch 'junio/next' by 1 commit.

Ah, yes, indeed; that makes sense. Scrap the patch.

-- Hannes

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] checkout without arguments does not make sense
  2008-07-21 20:49 ` Miklos Vajna
  2008-07-21 21:11   ` Johannes Sixt
@ 2008-07-21 21:36   ` Avery Pennarun
  2008-07-21 21:44     ` Miklos Vajna
  1 sibling, 1 reply; 6+ messages in thread
From: Avery Pennarun @ 2008-07-21 21:36 UTC (permalink / raw)
  To: Miklos Vajna; +Cc: Johannes Sixt, Junio C Hamano, git

On 7/21/08, Miklos Vajna <vmiklos@frugalware.org> wrote:
> Actually I think it _is_ useful, like this:
>
>  $ git checkout
>  Your branch is ahead of the tracked remote branch 'junio/next' by 1 commit.
>
>  How will it be possible to get that info easily after your patch?

Eek, are we using "checkout" to get status information now?  If that
goes wrong, you could be blowing away your locally modified data by
accident.

I think "git status" reports this information in recent versions, doesn't it?

Thanks,

Avery

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] checkout without arguments does not make sense
  2008-07-21 21:36   ` Avery Pennarun
@ 2008-07-21 21:44     ` Miklos Vajna
  2008-07-22  0:57       ` Johannes Schindelin
  0 siblings, 1 reply; 6+ messages in thread
From: Miklos Vajna @ 2008-07-21 21:44 UTC (permalink / raw)
  To: Avery Pennarun; +Cc: Johannes Sixt, Junio C Hamano, git

[-- Attachment #1: Type: text/plain, Size: 787 bytes --]

On Mon, Jul 21, 2008 at 05:36:59PM -0400, Avery Pennarun <apenwarr@gmail.com> wrote:
> Eek, are we using "checkout" to get status information now?  If that
> goes wrong, you could be blowing away your locally modified data by
> accident.

Hm, let's say I have uncommitted changes to Makefile, then I'll get:

$ git checkout
M       Makefile
Your branch is ahead of the tracked remote branch 'junio/next' by 1 commit.

But it will not drop my local changes.

> I think "git status" reports this information in recent versions, doesn't it?

Right. But that shows other infos as well, for example the untracked
files, etc. So there are cases when git checkout is just better.

However, you are right about it may not be the best habit from my side
to use git checkout to get that info. ;-)

[-- Attachment #2: Type: application/pgp-signature, Size: 197 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] checkout without arguments does not make sense
  2008-07-21 21:44     ` Miklos Vajna
@ 2008-07-22  0:57       ` Johannes Schindelin
  0 siblings, 0 replies; 6+ messages in thread
From: Johannes Schindelin @ 2008-07-22  0:57 UTC (permalink / raw)
  To: Miklos Vajna; +Cc: Avery Pennarun, Johannes Sixt, Junio C Hamano, git

Hi,

On Mon, 21 Jul 2008, Miklos Vajna wrote:

> On Mon, Jul 21, 2008 at 05:36:59PM -0400, Avery Pennarun <apenwarr@gmail.com> wrote:
>
> > I think "git status" reports this information in recent versions, 
> > doesn't it?
> 
> Right. But that shows other infos as well, for example the untracked 
> files, etc. So there are cases when git checkout is just better.
> 
> However, you are right about it may not be the best habit from my side 
> to use git checkout to get that info. ;-)

I usually call "git status" for that information.  But Junio suggested 
checkout recently on #git, for exactly that information, so you are not 
alone at all.

Ciao,
Dscho

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2008-07-22  0:58 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-07-21 20:06 [PATCH] checkout without arguments does not make sense Johannes Sixt
2008-07-21 20:49 ` Miklos Vajna
2008-07-21 21:11   ` Johannes Sixt
2008-07-21 21:36   ` Avery Pennarun
2008-07-21 21:44     ` Miklos Vajna
2008-07-22  0:57       ` Johannes Schindelin

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).