* Fwd: Delivery Status Notification (Failure)
[not found] ` <047d7b3a85a201067604d9a948e8@google.com>
@ 2013-04-06 4:15 ` Drew Gross
2013-04-06 4:49 ` Jeff King
0 siblings, 1 reply; 3+ messages in thread
From: Drew Gross @ 2013-04-06 4:15 UTC (permalink / raw)
To: git
Hello,
I'm am trying to patch git to refuse to commit if there are both staged and
unstaged changes, and I pass the -a flag. I expected this simple addition
to parse_and_validate_options() in commit.c to accomplish most of what I
want:
if (all && s->workdir_dirty)
die(_("Cannot commit with -a if there are staged and unstaged changes"));
But when compiled, this will commit anyway even with staged and unstaged
files. I think I misunderstanding the workdir_dirty flag. Can someone help
me?
Drew Gross
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Fwd: Delivery Status Notification (Failure)
2013-04-06 4:15 ` Fwd: Delivery Status Notification (Failure) Drew Gross
@ 2013-04-06 4:49 ` Jeff King
0 siblings, 0 replies; 3+ messages in thread
From: Jeff King @ 2013-04-06 4:49 UTC (permalink / raw)
To: Drew Gross; +Cc: git
On Sat, Apr 06, 2013 at 12:15:33AM -0400, Drew Gross wrote:
> I'm am trying to patch git to refuse to commit if there are both staged and
> unstaged changes, and I pass the -a flag. I expected this simple addition
> to parse_and_validate_options() in commit.c to accomplish most of what I
> want:
>
> if (all && s->workdir_dirty)
> die(_("Cannot commit with -a if there are staged and unstaged changes"));
>
> But when compiled, this will commit anyway even with staged and unstaged
> files. I think I misunderstanding the workdir_dirty flag. Can someone help
> me?
I am not sure if that is a good safety measure in general. But
ignoring that question for a moment, there are a few issues with your
proposed implementation:
1. workdir_dirty only talks about unstaged changes; it sounds like you
want to check for both staged and unstaged.
2. no flags in in the wt_status struct are set until wt_status_collect
is called; you need to put your check later. But of course by the
time we call it, we have already updated the index, so you would
not know anymore which changes were already in the index and which
were added by "-a".
3. we do not always run wt_collect_status (e.g., if you are not going
to run an editor, we do not bother going to the effort to create
the commit template).
So you'd probably need something more like this:
diff --git a/builtin/commit.c b/builtin/commit.c
index 4620437..ebb5480 100644
--- a/builtin/commit.c
+++ b/builtin/commit.c
@@ -1061,6 +1061,10 @@ static int parse_and_validate_options(int argc, const char *argv[],
if (status_format != STATUS_FORMAT_NONE)
dry_run = 1;
+ wt_status_collect(s);
+ if (all && s->change.nr && s->workdir_dirty)
+ die("Cannot use '-a' with staged and unstaged changes");
+
return argc;
}
Note that this may run the diff-index and diff-files procedures twice
(once here, and once later if we actually call run_status). If were
doing this for real (and I do not think it is something we want to take
upstream anyway), you would want to make sure that information was
cached.
-Peff
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Implement --password option for git svn perl script
@ 2010-01-29 14:17 Laszlo Papp
[not found] ` <001636ed7681994278047e4e4a6f@google.com>
0 siblings, 1 reply; 3+ messages in thread
From: Laszlo Papp @ 2010-01-29 14:17 UTC (permalink / raw)
To: git; +Cc: normalperson, lznuaa
Hello,
It would be nice to use --pasword option on windows, like --username
option with git svn facility. I can't handle SVN repository with git
svn on windows if I'd like to authenticate myself with other user than
the default domain name of my windows.
If I use --username option, Frank Li said me it's not enough in
TortoiseGIT to provide a popup facility to type the password related
to the set --username option.
What's your opinion/suggestion/recommendation ?
Best Regards,
Laszlo Papp
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2013-04-06 16:59 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <CAECh7fANnQDfSNHvOUH7AhyVNciypCKLXadY-jFxso4etCuvrg@mail.gmail.com>
[not found] ` <047d7b3a85a201067604d9a948e8@google.com>
2013-04-06 4:15 ` Fwd: Delivery Status Notification (Failure) Drew Gross
2013-04-06 4:49 ` Jeff King
2010-01-29 14:17 Implement --password option for git svn perl script Laszlo Papp
[not found] ` <001636ed7681994278047e4e4a6f@google.com>
2010-01-29 14:18 ` Fwd: Delivery Status Notification (Failure) Laszlo Papp
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).