#include "refs.h"
#include "csum-file.h"
#include "quote.h"
+#include "exec_cmd.h"
#define PACK_ID_BITS 16
#define MAX_PACK_ID ((1<<PACK_ID_BITS)-1)
{
const char *orig_src = src;
char *endp, sign;
+ unsigned long date;
- strtoul(src, &endp, 10);
- if (endp == src || *endp != ' ')
+ errno = 0;
+
+ date = strtoul(src, &endp, 10);
+ if (errno || endp == src || *endp != ' ')
return -1;
src = endp + 1;
return -1;
sign = *src;
- strtoul(src + 1, &endp, 10);
- if (endp == src || *endp || (endp - orig_src) >= maxlen)
+ date = strtoul(src + 1, &endp, 10);
+ if (errno || endp == src || *endp || (endp - orig_src) >= maxlen)
return -1;
strcpy(result, orig_src);
if (!p)
die("Corrupt mode: %s", command_buf.buf);
switch (mode) {
+ case 0644:
+ case 0755:
+ mode |= S_IFREG;
case S_IFREG | 0644:
case S_IFREG | 0755:
case S_IFLNK:
case S_IFGITLINK:
- case 0644:
- case 0755:
/* ok */
break;
default:
typename(type), command_buf.buf);
}
- tree_content_set(&b->branch_tree, p, sha1, S_IFREG | mode, NULL);
+ tree_content_set(&b->branch_tree, p, sha1, mode, NULL);
}
static void file_change_d(struct branch *b)
{
unsigned int i, show_stats = 1;
+ git_extract_argv0_path(argv[0]);
+
setup_git_directory();
git_config(git_pack_config, NULL);
if (!pack_compression_seen && core_compression_seen)