mirror of
https://github.com/git/git.git
synced 2024-11-17 14:34:49 +01:00
Merge branch 'js/fmt-patch' into next
* js/fmt-patch: fmt-patch: understand old <his> notation t1300-repo-config: two new config parsing tests. Another config file parsing fix.
This commit is contained in:
commit
c2b9e6994d
4 changed files with 43 additions and 2 deletions
|
@ -232,7 +232,7 @@ static int builtin_diff_combined(struct rev_info *revs,
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void add_head(struct rev_info *revs)
|
void add_head(struct rev_info *revs)
|
||||||
{
|
{
|
||||||
unsigned char sha1[20];
|
unsigned char sha1[20];
|
||||||
struct object *obj;
|
struct object *obj;
|
||||||
|
|
|
@ -11,6 +11,9 @@
|
||||||
#include "log-tree.h"
|
#include "log-tree.h"
|
||||||
#include "builtin.h"
|
#include "builtin.h"
|
||||||
|
|
||||||
|
/* this is in builtin-diff.c */
|
||||||
|
void add_head(struct rev_info *revs);
|
||||||
|
|
||||||
static int cmd_log_wc(int argc, const char **argv, char **envp,
|
static int cmd_log_wc(int argc, const char **argv, char **envp,
|
||||||
struct rev_info *rev)
|
struct rev_info *rev)
|
||||||
{
|
{
|
||||||
|
@ -185,6 +188,11 @@ int cmd_format_patch(int argc, const char **argv, char **envp)
|
||||||
if (argc > 1)
|
if (argc > 1)
|
||||||
die ("unrecognized argument: %s", argv[1]);
|
die ("unrecognized argument: %s", argv[1]);
|
||||||
|
|
||||||
|
if (rev.pending_objects && rev.pending_objects->next == NULL) {
|
||||||
|
rev.pending_objects->item->flags |= UNINTERESTING;
|
||||||
|
add_head(&rev);
|
||||||
|
}
|
||||||
|
|
||||||
if (!use_stdout)
|
if (!use_stdout)
|
||||||
realstdout = fdopen(dup(1), "w");
|
realstdout = fdopen(dup(1), "w");
|
||||||
|
|
||||||
|
|
4
config.c
4
config.c
|
@ -336,8 +336,10 @@ static int store_aux(const char* key, const char* value)
|
||||||
store.state = KEY_SEEN;
|
store.state = KEY_SEEN;
|
||||||
store.seen++;
|
store.seen++;
|
||||||
} else if (strrchr(key, '.') - key == store.baselen &&
|
} else if (strrchr(key, '.') - key == store.baselen &&
|
||||||
!strncmp(key, store.key, store.baselen))
|
!strncmp(key, store.key, store.baselen)) {
|
||||||
store.state = SECTION_SEEN;
|
store.state = SECTION_SEEN;
|
||||||
|
store.offset[store.seen] = ftell(config_file);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -278,5 +278,36 @@ git-repo-config > output 2>&1
|
||||||
test_expect_success 'no arguments, but no crash' \
|
test_expect_success 'no arguments, but no crash' \
|
||||||
"test $? = 129 && grep usage output"
|
"test $? = 129 && grep usage output"
|
||||||
|
|
||||||
|
cat > .git/config << EOF
|
||||||
|
[a.b]
|
||||||
|
c = d
|
||||||
|
EOF
|
||||||
|
|
||||||
|
git-repo-config a.x y
|
||||||
|
|
||||||
|
cat > expect << EOF
|
||||||
|
[a.b]
|
||||||
|
c = d
|
||||||
|
[a]
|
||||||
|
x = y
|
||||||
|
EOF
|
||||||
|
|
||||||
|
test_expect_success 'new section is partial match of another' 'cmp .git/config expect'
|
||||||
|
|
||||||
|
git-repo-config b.x y
|
||||||
|
git-repo-config a.b c
|
||||||
|
|
||||||
|
cat > expect << EOF
|
||||||
|
[a.b]
|
||||||
|
c = d
|
||||||
|
[a]
|
||||||
|
x = y
|
||||||
|
b = c
|
||||||
|
[b]
|
||||||
|
x = y
|
||||||
|
EOF
|
||||||
|
|
||||||
|
test_expect_success 'new variable inserts into proper section' 'cmp .git/config expect'
|
||||||
|
|
||||||
test_done
|
test_done
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue