Andrew's git
/
gitweb.git
/ diff
summary
|
log
|
commit
| diff |
tree
commit
grep
author
committer
pickaxe
?
re
attr: skip UTF8 BOM at the beginning of the input file
author
Junio C Hamano
<gitster@pobox.com>
Thu, 16 Apr 2015 17:48:58 +0000
(10:48 -0700)
committer
Junio C Hamano
<gitster@pobox.com>
Thu, 16 Apr 2015 18:35:38 +0000
(11:35 -0700)
Signed-off-by: Junio C Hamano <gitster@pobox.com>
attr.c
patch
|
blob
|
history
raw
|
patch
|
inline
| side by side (parent:
599446d
)
diff --git
a/attr.c
b/attr.c
index cd5469770a6f7841ae327e6ba7141dd99d9cacc1..7c530f4d0c4c70666d49a97ed45e16461ccce702 100644
(file)
--- a/
attr.c
+++ b/
attr.c
@@
-12,6
+12,7
@@
#include "exec_cmd.h"
#include "attr.h"
#include "dir.h"
#include "exec_cmd.h"
#include "attr.h"
#include "dir.h"
+#include "utf8.h"
const char git_attr__true[] = "(builtin)true";
const char git_attr__false[] = "\0(builtin)false";
const char git_attr__true[] = "(builtin)true";
const char git_attr__false[] = "\0(builtin)false";
@@
-369,8
+370,12
@@
static struct attr_stack *read_attr_from_file(const char *path, int macro_ok)
return NULL;
}
res = xcalloc(1, sizeof(*res));
return NULL;
}
res = xcalloc(1, sizeof(*res));
- while (fgets(buf, sizeof(buf), fp))
- handle_attr_line(res, buf, path, ++lineno, macro_ok);
+ while (fgets(buf, sizeof(buf), fp)) {
+ char *bufp = buf;
+ if (!lineno)
+ skip_utf8_bom(&bufp, strlen(bufp));
+ handle_attr_line(res, bufp, path, ++lineno, macro_ok);
+ }
fclose(fp);
return res;
}
fclose(fp);
return res;
}