Fix detection of whether git-stash is needed.

I broke the code that determines whether git-stash is determined in
commit 2b0d0d6248. The problem is that
the system() Perl function returns the exit code and miscellaneous
process exit data (such as whether the process failed to run, etc.)
and I actually needed that data.

In the commit I refer to, I switched to my safe_system() which only
returns the exit code and now kdesrc-build thought there was an error
running git, when instead git was returning the proper exit code for
a module with local changes. Thanks to dfaure for the report.

Not closing the bug here in case I merge this somewhere else later.

CCBUG:265325
wilder
Michael Pyne 15 years ago
parent 5735e9eb71
commit 7c2ee0f714
  1. 5
      kdesrc-build

@ -1992,7 +1992,8 @@ sub git_stash_and_update
# To find out if we should stash, we just use git diff --quiet, twice to
# account for the index and the working dir.
my $status = safe_system('git', 'diff', '--quiet');
# Note: Don't use safe_system, as the error code is stripped to the exit code
my $status = pretending() ? 0 : system('git', 'diff', '--quiet');
if ($status == -1 || $status & 127) {
die make_exception('Runtime',
@ -2006,7 +2007,7 @@ sub git_stash_and_update
$needsStash = 1;
}
else {
$status = safe_system('git', 'diff', '--cached', '--quiet');
$status = pretending() ? 0 : system('git', 'diff', '--cached', '--quiet');
if ($status == -1 || $status & 127) {
die make_exception('Runtime',
"$module doesn't appear to be a git module when" .

Loading…
Cancel
Save