File tree Expand file tree Collapse file tree 2 files changed +33
-31
lines changed Expand file tree Collapse file tree 2 files changed +33
-31
lines changed Original file line number Diff line number Diff line change @@ -17,37 +17,6 @@ static const char *merge_argument(struct commit *commit)
17
17
return EMPTY_TREE_SHA1_HEX ;
18
18
}
19
19
20
- int index_has_changes (struct strbuf * sb )
21
- {
22
- struct object_id head ;
23
- int i ;
24
-
25
- if (!get_oid_tree ("HEAD" , & head )) {
26
- struct diff_options opt ;
27
-
28
- diff_setup (& opt );
29
- opt .flags .exit_with_status = 1 ;
30
- if (!sb )
31
- opt .flags .quick = 1 ;
32
- do_diff_cache (& head , & opt );
33
- diffcore_std (& opt );
34
- for (i = 0 ; sb && i < diff_queued_diff .nr ; i ++ ) {
35
- if (i )
36
- strbuf_addch (sb , ' ' );
37
- strbuf_addstr (sb , diff_queued_diff .queue [i ]-> two -> path );
38
- }
39
- diff_flush (& opt );
40
- return opt .flags .has_changes != 0 ;
41
- } else {
42
- for (i = 0 ; sb && i < active_nr ; i ++ ) {
43
- if (i )
44
- strbuf_addch (sb , ' ' );
45
- strbuf_addstr (sb , active_cache [i ]-> name );
46
- }
47
- return !!active_nr ;
48
- }
49
- }
50
-
51
20
int try_merge_command (const char * strategy , size_t xopts_nr ,
52
21
const char * * xopts , struct commit_list * common ,
53
22
const char * head_arg , struct commit_list * remotes )
Original file line number Diff line number Diff line change 6
6
#define NO_THE_INDEX_COMPATIBILITY_MACROS
7
7
#include "cache.h"
8
8
#include "config.h"
9
+ #include "diff.h"
10
+ #include "diffcore.h"
9
11
#include "tempfile.h"
10
12
#include "lockfile.h"
11
13
#include "cache-tree.h"
@@ -1984,6 +1986,37 @@ int unmerged_index(const struct index_state *istate)
1984
1986
return 0 ;
1985
1987
}
1986
1988
1989
+ int index_has_changes (struct strbuf * sb )
1990
+ {
1991
+ struct object_id head ;
1992
+ int i ;
1993
+
1994
+ if (!get_oid_tree ("HEAD" , & head )) {
1995
+ struct diff_options opt ;
1996
+
1997
+ diff_setup (& opt );
1998
+ opt .flags .exit_with_status = 1 ;
1999
+ if (!sb )
2000
+ opt .flags .quick = 1 ;
2001
+ do_diff_cache (& head , & opt );
2002
+ diffcore_std (& opt );
2003
+ for (i = 0 ; sb && i < diff_queued_diff .nr ; i ++ ) {
2004
+ if (i )
2005
+ strbuf_addch (sb , ' ' );
2006
+ strbuf_addstr (sb , diff_queued_diff .queue [i ]-> two -> path );
2007
+ }
2008
+ diff_flush (& opt );
2009
+ return opt .flags .has_changes != 0 ;
2010
+ } else {
2011
+ for (i = 0 ; sb && i < the_index .cache_nr ; i ++ ) {
2012
+ if (i )
2013
+ strbuf_addch (sb , ' ' );
2014
+ strbuf_addstr (sb , the_index .cache [i ]-> name );
2015
+ }
2016
+ return !!the_index .cache_nr ;
2017
+ }
2018
+ }
2019
+
1987
2020
#define WRITE_BUFFER_SIZE 8192
1988
2021
static unsigned char write_buffer [WRITE_BUFFER_SIZE ];
1989
2022
static unsigned long write_buffer_len ;
You can’t perform that action at this time.
0 commit comments