350
};
351
352
/* Name hashing */
353
-extern int test_lazy_init_name_hash(struct index_state *istate, int try_threaded);
354
-extern void add_name_hash(struct index_state *istate, struct cache_entry *ce);
355
-extern void remove_name_hash(struct index_state *istate, struct cache_entry *ce);
356
-extern void free_name_hash(struct index_state *istate);
353
+int test_lazy_init_name_hash(struct index_state *istate, int try_threaded);
354
+void add_name_hash(struct index_state *istate, struct cache_entry *ce);
355
+void remove_name_hash(struct index_state *istate, struct cache_entry *ce);
356
+void free_name_hash(struct index_state *istate);
357
358
359
/* Cache entry creation and cleanup */
543
*/
544
extern const char * const local_repo_env[];
545
546
-extern void setup_git_env(const char *git_dir);
546
+void setup_git_env(const char *git_dir);
547
548
/*
549
* Returns true iff we have a configured git repository (either via
552
int have_git_dir(void);
553
554
extern int is_bare_repository_cfg;
555
-extern int is_bare_repository(void);
556
-extern int is_inside_git_dir(void);
555
+int is_bare_repository(void);
556
+int is_inside_git_dir(void);
557
extern char *git_work_tree_cfg;
558
-extern int is_inside_work_tree(void);
559
-extern const char *get_git_dir(void);
560
-extern const char *get_git_common_dir(void);
561
-extern char *get_object_directory(void);
562
-extern char *get_index_file(void);
563
-extern char *get_graft_file(struct repository *r);
564
-extern void set_git_dir(const char *path);
565
-extern int get_common_dir_noenv(struct strbuf *sb, const char *gitdir);
566
-extern int get_common_dir(struct strbuf *sb, const char *gitdir);
567
-extern const char *get_git_namespace(void);
568
-extern const char *strip_namespace(const char *namespaced_ref);
569
-extern const char *get_super_prefix(void);
570
-extern const char *get_git_work_tree(void);
558
+int is_inside_work_tree(void);
559
+const char *get_git_dir(void);
560
+const char *get_git_common_dir(void);
561
+char *get_object_directory(void);
562
+char *get_index_file(void);
563
+char *get_graft_file(struct repository *r);
564
+void set_git_dir(const char *path);
565
+int get_common_dir_noenv(struct strbuf *sb, const char *gitdir);
566
+int get_common_dir(struct strbuf *sb, const char *gitdir);
567
+const char *get_git_namespace(void);
568
+const char *strip_namespace(const char *namespaced_ref);
569
+const char *get_super_prefix(void);
570
+const char *get_git_work_tree(void);
571
572
/*
573
* Return true if the given path is a git directory; note that this _just_
574
* looks at the directory itself. If you want to know whether "foo/.git"
575
* is a repository, you must feed that path, not just "foo".
576
*/
577
-extern int is_git_directory(const char *path);
577
+int is_git_directory(const char *path);
578
579
/*
580
* Return 1 if the given path is the root of a git repository or
586
* as we usually consider sub-repos precious, and would prefer to err on the
587
* side of not disrupting or deleting them.
588
*/
589
-extern int is_nonbare_repository_dir(struct strbuf *path);
589
+int is_nonbare_repository_dir(struct strbuf *path);
590
591
#define READ_GITFILE_ERR_STAT_FAILED 1
592
#define READ_GITFILE_ERR_NOT_A_FILE 2
596
#define READ_GITFILE_ERR_NO_PATH 6
597
#define READ_GITFILE_ERR_NOT_A_REPO 7
598
#define READ_GITFILE_ERR_TOO_LARGE 8
599
-extern void read_gitfile_error_die(int error_code, const char *path, const char *dir);
600
-extern const char *read_gitfile_gently(const char *path, int *return_error_code);
599
+void read_gitfile_error_die(int error_code, const char *path, const char *dir);
600
+const char *read_gitfile_gently(const char *path, int *return_error_code);
601
#define read_gitfile(path) read_gitfile_gently((path), NULL)
602
-extern const char *resolve_gitdir_gently(const char *suspect, int *return_error_code);
602
+const char *resolve_gitdir_gently(const char *suspect, int *return_error_code);
603
#define resolve_gitdir(path) resolve_gitdir_gently((path), NULL)
604
605
-extern void set_git_work_tree(const char *tree);
605
+void set_git_work_tree(const char *tree);
606
607
#define ALTERNATE_DB_ENVIRONMENT "GIT_ALTERNATE_OBJECT_DIRECTORIES"
608
609
-extern void setup_work_tree(void);
609
+void setup_work_tree(void);
610
/*
611
* Find the commondir and gitdir of the repository that contains the current
612
* working directory, without changing the working directory or other global
615
* both have the same result appended to the buffer. The return value is
616
* either 0 upon success and non-zero if no repository was found.
617
*/
618
-extern int discover_git_directory(struct strbuf *commondir,
618
+int discover_git_directory(struct strbuf *commondir,
619
struct strbuf *gitdir);
620
-extern const char *setup_git_directory_gently(int *);
621
-extern const char *setup_git_directory(void);
622
-extern char *prefix_path(const char *prefix, int len, const char *path);
623
-extern char *prefix_path_gently(const char *prefix, int len, int *remaining, const char *path);
620
+const char *setup_git_directory_gently(int *);
621
+const char *setup_git_directory(void);
622
+char *prefix_path(const char *prefix, int len, const char *path);
623
+char *prefix_path_gently(const char *prefix, int len, int *remaining, const char *path);
624
625
/*
626
* Concatenate "prefix" (if len is non-zero) and "path", with no
632
* The return value is always a newly allocated string (even if the
633
* prefix was empty).
634
*/
635
-extern char *prefix_filename(const char *prefix, const char *path);
635
+char *prefix_filename(const char *prefix, const char *path);
636
637
-extern int check_filename(const char *prefix, const char *name);
638
-extern void verify_filename(const char *prefix,
637
+int check_filename(const char *prefix, const char *name);
638
+void verify_filename(const char *prefix,
639
const char *name,
640
int diagnose_misspelt_rev);
641
-extern void verify_non_filename(const char *prefix, const char *name);
642
-extern int path_inside_repo(const char *prefix, const char *path);
641
+void verify_non_filename(const char *prefix, const char *name);
642
+int path_inside_repo(const char *prefix, const char *path);
643
644
#define INIT_DB_QUIET 0x0001
645
#define INIT_DB_EXIST_OK 0x0002
646
647
-extern int init_db(const char *git_dir, const char *real_git_dir,
647
+int init_db(const char *git_dir, const char *real_git_dir,
648
const char *template_dir, unsigned int flags);
649
650
-extern void sanitize_stdfds(void);
651
-extern int daemonize(void);
650
+void sanitize_stdfds(void);
651
+int daemonize(void);
652
653
#define alloc_nr(x) (((x)+16)*3/2)
654
672
673
/* Initialize and use the cache information */
674
struct lock_file;
675
-extern void preload_index(struct index_state *index,
675
+void preload_index(struct index_state *index,
676
const struct pathspec *pathspec,
677
unsigned int refresh_flags);
678
-extern int do_read_index(struct index_state *istate, const char *path,
678
+int do_read_index(struct index_state *istate, const char *path,
679
int must_exist); /* for testting only! */
680
-extern int read_index_from(struct index_state *, const char *path,
680
+int read_index_from(struct index_state *, const char *path,
681
const char *gitdir);
682
-extern int is_index_unborn(struct index_state *);
682
+int is_index_unborn(struct index_state *);
683
684
/* For use with `write_locked_index()`. */
685
#define COMMIT_LOCK (1 << 0)
704
* If `SKIP_IF_UNCHANGED` is given and the index is unchanged, nothing
705
* is written (and the lock is rolled back if `COMMIT_LOCK` is given).
706
*/
707
-extern int write_locked_index(struct index_state *, struct lock_file *lock, unsigned flags);
707
+int write_locked_index(struct index_state *, struct lock_file *lock, unsigned flags);
708
709
-extern int discard_index(struct index_state *);
710
-extern void move_index_extensions(struct index_state *dst, struct index_state *src);
711
-extern int unmerged_index(const struct index_state *);
709
+int discard_index(struct index_state *);
710
+void move_index_extensions(struct index_state *dst, struct index_state *src);
711
+int unmerged_index(const struct index_state *);
712
713
/**
714
* Returns 1 if istate differs from tree, 0 otherwise. If tree is NULL,
717
* provided, the space-separated list of files that differ will be appended
718
* to it.
719
*/
720
-extern int repo_index_has_changes(struct repository *repo,
720
+int repo_index_has_changes(struct repository *repo,
721
struct tree *tree,
722
struct strbuf *sb);
723
724
-extern int verify_path(const char *path, unsigned mode);
725
-extern int strcmp_offset(const char *s1, const char *s2, size_t *first_change);
726
-extern int index_dir_exists(struct index_state *istate, const char *name, int namelen);
727
-extern void adjust_dirname_case(struct index_state *istate, char *name);
728
-extern struct cache_entry *index_file_exists(struct index_state *istate, const char *name, int namelen, int igncase);
724
+int verify_path(const char *path, unsigned mode);
725
+int strcmp_offset(const char *s1, const char *s2, size_t *first_change);
726
+int index_dir_exists(struct index_state *istate, const char *name, int namelen);
727
+void adjust_dirname_case(struct index_state *istate, char *name);
728
+struct cache_entry *index_file_exists(struct index_state *istate, const char *name, int namelen, int igncase);
729
730
/*
731
* Searches for an entry defined by name and namelen in the given index.
744
* index_name_pos(&index, "f", 1) -> -3
745
* index_name_pos(&index, "g", 1) -> -5
746
*/
747
-extern int index_name_pos(const struct index_state *, const char *name, int namelen);
747
+int index_name_pos(const struct index_state *, const char *name, int namelen);
748
749
#define ADD_CACHE_OK_TO_ADD 1 /* Ok to add */
750
#define ADD_CACHE_OK_TO_REPLACE 2 /* Ok to replace file/directory */
753
#define ADD_CACHE_NEW_ONLY 16 /* Do not replace existing ones */
754
#define ADD_CACHE_KEEP_CACHE_TREE 32 /* Do not invalidate cache-tree */
755
#define ADD_CACHE_RENORMALIZE 64 /* Pass along HASH_RENORMALIZE */
756
-extern int add_index_entry(struct index_state *, struct cache_entry *ce, int option);
757
-extern void rename_index_entry_at(struct index_state *, int pos, const char *new_name);
756
+int add_index_entry(struct index_state *, struct cache_entry *ce, int option);
757
+void rename_index_entry_at(struct index_state *, int pos, const char *new_name);
758
759
/* Remove entry, return true if there are more entries to go. */
760
-extern int remove_index_entry_at(struct index_state *, int pos);
760
+int remove_index_entry_at(struct index_state *, int pos);
761
762
-extern void remove_marked_cache_entries(struct index_state *istate, int invalidate);
763
-extern int remove_file_from_index(struct index_state *, const char *path);
762
+void remove_marked_cache_entries(struct index_state *istate, int invalidate);
763
+int remove_file_from_index(struct index_state *, const char *path);
764
#define ADD_CACHE_VERBOSE 1
765
#define ADD_CACHE_PRETEND 2
766
#define ADD_CACHE_IGNORE_ERRORS 4
775
* the latter will do necessary lstat(2) internally before
776
* calling the former.
777
*/
778
-extern int add_to_index(struct index_state *, const char *path, struct stat *, int flags);
779
-extern int add_file_to_index(struct index_state *, const char *path, int flags);
778
+int add_to_index(struct index_state *, const char *path, struct stat *, int flags);
779
+int add_file_to_index(struct index_state *, const char *path, int flags);
780
781
-extern int chmod_index_entry(struct index_state *, struct cache_entry *ce, char flip);
782
-extern int ce_same_name(const struct cache_entry *a, const struct cache_entry *b);
783
-extern void set_object_name_for_intent_to_add_entry(struct cache_entry *ce);
784
-extern int index_name_is_other(const struct index_state *, const char *, int);
785
-extern void *read_blob_data_from_index(const struct index_state *, const char *, unsigned long *);
781
+int chmod_index_entry(struct index_state *, struct cache_entry *ce, char flip);
782
+int ce_same_name(const struct cache_entry *a, const struct cache_entry *b);
783
+void set_object_name_for_intent_to_add_entry(struct cache_entry *ce);
784
+int index_name_is_other(const struct index_state *, const char *, int);
785
+void *read_blob_data_from_index(const struct index_state *, const char *, unsigned long *);
786
787
/* do stat comparison even if CE_VALID is true */
788
#define CE_MATCH_IGNORE_VALID 01
796
#define CE_MATCH_REFRESH 0x10
797
/* don't refresh_fsmonitor state or do stat comparison even if CE_FSMONITOR_VALID is true */
798
#define CE_MATCH_IGNORE_FSMONITOR 0X20
799
-extern int is_racy_timestamp(const struct index_state *istate,
799
+int is_racy_timestamp(const struct index_state *istate,
800
const struct cache_entry *ce);
801
-extern int ie_match_stat(struct index_state *, const struct cache_entry *, struct stat *, unsigned int);
802
-extern int ie_modified(struct index_state *, const struct cache_entry *, struct stat *, unsigned int);
801
+int ie_match_stat(struct index_state *, const struct cache_entry *, struct stat *, unsigned int);
802
+int ie_modified(struct index_state *, const struct cache_entry *, struct stat *, unsigned int);
803
804
#define HASH_WRITE_OBJECT 1
805
#define HASH_FORMAT_CHECK 2
806
#define HASH_RENORMALIZE 4
807
-extern int index_fd(struct index_state *istate, struct object_id *oid, int fd, struct stat *st, enum object_type type, const char *path, unsigned flags);
808
-extern int index_path(struct index_state *istate, struct object_id *oid, const char *path, struct stat *st, unsigned flags);
807
+int index_fd(struct index_state *istate, struct object_id *oid, int fd, struct stat *st, enum object_type type, const char *path, unsigned flags);
808
+int index_path(struct index_state *istate, struct object_id *oid, const char *path, struct stat *st, unsigned flags);
809
810
/*
811
* Record to sd the data from st that we use to check whether a file
812
* might have changed.
813
*/
814
-extern void fill_stat_data(struct stat_data *sd, struct stat *st);
814
+void fill_stat_data(struct stat_data *sd, struct stat *st);
815
816
/*
817
* Return 0 if st is consistent with a file not having been changed
819
* combination of MTIME_CHANGED, CTIME_CHANGED, OWNER_CHANGED,
820
* INODE_CHANGED, and DATA_CHANGED.
821
*/
822
-extern int match_stat_data(const struct stat_data *sd, struct stat *st);
823
-extern int match_stat_data_racy(const struct index_state *istate,
822
+int match_stat_data(const struct stat_data *sd, struct stat *st);
823
+int match_stat_data_racy(const struct index_state *istate,
824
const struct stat_data *sd, struct stat *st);
825
826
-extern void fill_stat_cache_info(struct cache_entry *ce, struct stat *st);
826
+void fill_stat_cache_info(struct cache_entry *ce, struct stat *st);
827
828
#define REFRESH_REALLY 0x0001 /* ignore_valid */
829
#define REFRESH_UNMERGED 0x0002 /* allow unmerged */
832
#define REFRESH_IGNORE_SUBMODULES 0x0010 /* ignore submodules */
833
#define REFRESH_IN_PORCELAIN 0x0020 /* user friendly output, not "needs update" */
834
#define REFRESH_PROGRESS 0x0040 /* show progress bar if stderr is tty */
835
-extern int refresh_index(struct index_state *, unsigned int flags, const struct pathspec *pathspec, char *seen, const char *header_msg);
836
-extern struct cache_entry *refresh_cache_entry(struct index_state *, struct cache_entry *, unsigned int);
835
+int refresh_index(struct index_state *, unsigned int flags, const struct pathspec *pathspec, char *seen, const char *header_msg);
836
+struct cache_entry *refresh_cache_entry(struct index_state *, struct cache_entry *, unsigned int);
837
838
-extern void set_alternate_index_output(const char *);
838
+void set_alternate_index_output(const char *);
839
840
extern int verify_index_checksum;
841
extern int verify_ce_order;
1020
* set_git_dir() before calling this, and use it only for "are we in a valid
1021
* repo?".
1022
*/
1023
-extern void check_repository_format(void);
1023
+void check_repository_format(void);
1024
1025
#define MTIME_CHANGED 0x0001
1026
#define CTIME_CHANGED 0x0002
1045
* Note that while this version avoids the static buffer, it is not fully
1046
* reentrant, as it calls into other non-reentrant git code.
1047
*/
1048
-extern const char *find_unique_abbrev(const struct object_id *oid, int len);
1049
-extern int find_unique_abbrev_r(char *hex, const struct object_id *oid, int len);
1048
+const char *find_unique_abbrev(const struct object_id *oid, int len);
1049
+int find_unique_abbrev_r(char *hex, const struct object_id *oid, int len);
1050
1051
extern const unsigned char null_sha1[GIT_MAX_RAWSZ];
1052
extern const struct object_id null_oid;
1242
int raceproof_create_file(const char *path, create_file_fn fn, void *cb);
1243
1244
int mkdir_in_gitdir(const char *path);
1245
-extern char *expand_user_path(const char *path, int real_home);
1245
+char *expand_user_path(const char *path, int real_home);
1246
const char *enter_repo(const char *path, int strict);
1247
static inline int is_absolute_path(const char *path)
1248
{
1286
* "$XDG_CONFIG_HOME/git/$filename" if $XDG_CONFIG_HOME is non-empty, otherwise
1287
* "$HOME/.config/git/$filename". Return NULL upon error.
1288
*/
1289
-extern char *xdg_config_home(const char *filename);
1289
+char *xdg_config_home(const char *filename);
1290
1291
/**
1292
* Return a newly allocated string with the evaluation of
1293
* "$XDG_CACHE_HOME/git/$filename" if $XDG_CACHE_HOME is non-empty, otherwise
1294
* "$HOME/.cache/git/$filename". Return NULL upon error.
1295
*/
1296
-extern char *xdg_cache_home(const char *filename);
1296
+char *xdg_cache_home(const char *filename);
1297
1298
-extern int git_open_cloexec(const char *name, int flags);
1298
+int git_open_cloexec(const char *name, int flags);
1299
#define git_open(name) git_open_cloexec(name, O_RDONLY)
1300
-extern int unpack_loose_header(git_zstream *stream, unsigned char *map, unsigned long mapsize, void *buffer, unsigned long bufsiz);
1301
-extern int parse_loose_header(const char *hdr, unsigned long *sizep);
1300
+int unpack_loose_header(git_zstream *stream, unsigned char *map, unsigned long mapsize, void *buffer, unsigned long bufsiz);
1301
+int parse_loose_header(const char *hdr, unsigned long *sizep);
1302
1303
-extern int check_object_signature(const struct object_id *oid, void *buf, unsigned long size, const char *type);
1303
+int check_object_signature(const struct object_id *oid, void *buf, unsigned long size, const char *type);
1304
1305
-extern int finalize_object_file(const char *tmpfile, const char *filename);
1305
+int finalize_object_file(const char *tmpfile, const char *filename);
1306
1307
/* Helper to check and "touch" a file */
1308
-extern int check_and_freshen_file(const char *fn, int freshen);
1308
+int check_and_freshen_file(const char *fn, int freshen);
1309
1310
extern const signed char hexval_table[256];
1311
static inline unsigned int hexval(unsigned char c)
1378
*/
1379
};
1380
1381
-extern int get_oid(const char *str, struct object_id *oid);
1382
-extern int get_oid_commit(const char *str, struct object_id *oid);
1383
-extern int get_oid_committish(const char *str, struct object_id *oid);
1384
-extern int get_oid_tree(const char *str, struct object_id *oid);
1385
-extern int get_oid_treeish(const char *str, struct object_id *oid);
1386
-extern int get_oid_blob(const char *str, struct object_id *oid);
1387
-extern void maybe_die_on_misspelt_object_name(const char *name, const char *prefix);
1388
-extern enum get_oid_result get_oid_with_context(struct repository *repo, const char *str,
1381
+int get_oid(const char *str, struct object_id *oid);
1382
+int get_oid_commit(const char *str, struct object_id *oid);
1383
+int get_oid_committish(const char *str, struct object_id *oid);
1384
+int get_oid_tree(const char *str, struct object_id *oid);
1385
+int get_oid_treeish(const char *str, struct object_id *oid);
1386
+int get_oid_blob(const char *str, struct object_id *oid);
1387
+void maybe_die_on_misspelt_object_name(const char *name, const char *prefix);
1388
+enum get_oid_result get_oid_with_context(struct repository *repo, const char *str,
1389
unsigned flags, struct object_id *oid,
1390
struct object_context *oc);
1391
1392
typedef int each_abbrev_fn(const struct object_id *oid, void *);
1393
-extern int for_each_abbrev(const char *prefix, each_abbrev_fn, void *);
1393
+int for_each_abbrev(const char *prefix, each_abbrev_fn, void *);
1394
1395
-extern int set_disambiguate_hint_config(const char *var, const char *value);
1395
+int set_disambiguate_hint_config(const char *var, const char *value);
1396
1397
/*
1398
* Try to read a SHA1 in hexadecimal format from the 40 characters
1401
* input, so it is safe to pass this function an arbitrary
1402
* null-terminated string.
1403
*/
1404
-extern int get_sha1_hex(const char *hex, unsigned char *sha1);
1405
-extern int get_oid_hex(const char *hex, struct object_id *sha1);
1404
+int get_sha1_hex(const char *hex, unsigned char *sha1);
1405
+int get_oid_hex(const char *hex, struct object_id *sha1);
1406
1407
/*
1408
* Read `len` pairs of hexadecimal digits from `hex` and write the
1409
* values to `binary` as `len` bytes. Return 0 on success, or -1 if
1410
* the input does not consist of hex digits).
1411
*/
1412
-extern int hex_to_bytes(unsigned char *binary, const char *hex, size_t len);
1412
+int hex_to_bytes(unsigned char *binary, const char *hex, size_t len);
1413
1414
/*
1415
* Convert a binary hash to its hex equivalent. The `_r` variant is reentrant,
1437
* other invalid character. end is only updated on success; otherwise, it is
1438
* unmodified.
1439
*/
1440
-extern int parse_oid_hex(const char *hex, struct object_id *oid, const char **end);
1440
+int parse_oid_hex(const char *hex, struct object_id *oid, const char **end);
1441
1442
/*
1443
* This reads short-hand syntax that not only evaluates to a commit
1468
#define INTERPRET_BRANCH_LOCAL (1<<0)
1469
#define INTERPRET_BRANCH_REMOTE (1<<1)
1470
#define INTERPRET_BRANCH_HEAD (1<<2)
1471
-extern int interpret_branch_name(const char *str, int len, struct strbuf *,
1471
+int interpret_branch_name(const char *str, int len, struct strbuf *,
1472
unsigned allowed);
1473
-extern int get_oid_mb(const char *str, struct object_id *oid);
1473
+int get_oid_mb(const char *str, struct object_id *oid);
1474
1475
-extern int validate_headref(const char *ref);
1475
+int validate_headref(const char *ref);
1476
1477
-extern int base_name_compare(const char *name1, int len1, int mode1, const char *name2, int len2, int mode2);
1478
-extern int df_name_compare(const char *name1, int len1, int mode1, const char *name2, int len2, int mode2);
1479
-extern int name_compare(const char *name1, size_t len1, const char *name2, size_t len2);
1480
-extern int cache_name_stage_compare(const char *name1, int len1, int stage1, const char *name2, int len2, int stage2);
1477
+int base_name_compare(const char *name1, int len1, int mode1, const char *name2, int len2, int mode2);
1478
+int df_name_compare(const char *name1, int len1, int mode1, const char *name2, int len2, int mode2);
1479
+int name_compare(const char *name1, size_t len1, const char *name2, size_t len2);
1480
+int cache_name_stage_compare(const char *name1, int len1, int stage1, const char *name2, int len2, int stage2);
1481
1482
-extern void *read_object_with_reference(const struct object_id *oid,
1482
+void *read_object_with_reference(const struct object_id *oid,
1483
const char *required_type,
1484
unsigned long *size,
1485
struct object_id *oid_ret);
1486
1487
-extern struct object *peel_to_type(const char *name, int namelen,
1487
+struct object *peel_to_type(const char *name, int namelen,
1488
struct object *o, enum object_type);
1489
1490
enum date_mode_type {
1539
WANT_COMMITTER_IDENT
1540
};
1541
1542
-extern const char *git_author_info(int);
1543
-extern const char *git_committer_info(int);
1544
-extern const char *fmt_ident(const char *name, const char *email,
1542
+const char *git_author_info(int);
1543
+const char *git_committer_info(int);
1544
+const char *fmt_ident(const char *name, const char *email,
1545
enum want_ident whose_ident,
1546
const char *date_str, int);
1547
-extern const char *fmt_name(enum want_ident);
1548
-extern const char *ident_default_name(void);
1549
-extern const char *ident_default_email(void);
1550
-extern const char *git_editor(void);
1551
-extern const char *git_sequence_editor(void);
1552
-extern const char *git_pager(int stdout_is_tty);
1553
-extern int is_terminal_dumb(void);
1554
-extern int git_ident_config(const char *, const char *, void *);
1555
-extern void reset_ident_date(void);
1547
+const char *fmt_name(enum want_ident);
1548
+const char *ident_default_name(void);
1549
+const char *ident_default_email(void);
1550
+const char *git_editor(void);
1551
+const char *git_sequence_editor(void);
1552
+const char *git_pager(int stdout_is_tty);
1553
+int is_terminal_dumb(void);
1554
+int git_ident_config(const char *, const char *, void *);
1555
+void reset_ident_date(void);
1556
1557
struct ident_split {
1558
const char *name_begin;
1568
* Signals an success with 0, but time part of the result may be NULL
1569
* if the input lacks timestamp and zone
1570
*/
1571
-extern int split_ident_line(struct ident_split *, const char *, int);
1571
+int split_ident_line(struct ident_split *, const char *, int);
1572
1573
/*
1574
* Like show_date, but pull the timestamp and tz parameters from
1585
* Because there are two fields, we must choose one as the primary key; we
1586
* currently arbitrarily pick the email.
1587
*/
1588
-extern int ident_cmp(const struct ident_split *, const struct ident_split *);
1588
+int ident_cmp(const struct ident_split *, const struct ident_split *);
1589
1590
struct checkout {
1591
struct index_state *istate;
1601
#define CHECKOUT_INIT { NULL, "" }
1602
1603
#define TEMPORARY_FILENAME_LENGTH 25
1604
-extern int checkout_entry(struct cache_entry *ce, const struct checkout *state, char *topath, int *nr_checkouts);
1605
-extern void enable_delayed_checkout(struct checkout *state);
1606
-extern int finish_delayed_checkout(struct checkout *state, int *nr_checkouts);
1604
+int checkout_entry(struct cache_entry *ce, const struct checkout *state, char *topath, int *nr_checkouts);
1605
+void enable_delayed_checkout(struct checkout *state);
1606
+int finish_delayed_checkout(struct checkout *state, int *nr_checkouts);
1607
/*
1608
* Unlink the last component and schedule the leading directories for
1609
* removal, such that empty directories get removed.
1610
*/
1611
-extern void unlink_entry(const struct cache_entry *ce);
1611
+void unlink_entry(const struct cache_entry *ce);
1612
1613
struct cache_def {
1614
struct strbuf path;
1622
strbuf_release(&cache->path);
1623
}
1624
1625
-extern int has_symlink_leading_path(const char *name, int len);
1626
-extern int threaded_has_symlink_leading_path(struct cache_def *, const char *, int);
1627
-extern int check_leading_path(const char *name, int len);
1628
-extern int has_dirs_only_path(const char *name, int len, int prefix_len);
1629
-extern void schedule_dir_for_removal(const char *name, int len);
1630
-extern void remove_scheduled_dirs(void);
1625
+int has_symlink_leading_path(const char *name, int len);
1626
+int threaded_has_symlink_leading_path(struct cache_def *, const char *, int);
1627
+int check_leading_path(const char *name, int len);
1628
+int has_dirs_only_path(const char *name, int len, int prefix_len);
1629
+void schedule_dir_for_removal(const char *name, int len);
1630
+void remove_scheduled_dirs(void);
1631
1632
struct pack_window {
1633
struct pack_window *next;
1649
* usual "XXXXXX" trailer, and the resulting filename is written into the
1650
* "template" buffer. Returns the open descriptor.
1651
*/
1652
-extern int odb_mkstemp(struct strbuf *temp_filename, const char *pattern);
1652
+int odb_mkstemp(struct strbuf *temp_filename, const char *pattern);
1653
1654
/*
1655
* Create a pack .keep file named "name" (which should generally be the output
1656
* of odb_pack_name). Returns a file descriptor opened for writing, or -1 on
1657
* error.
1658
*/
1659
-extern int odb_pack_keep(const char *name);
1659
+int odb_pack_keep(const char *name);
1660
1661
/*
1662
* Set this to 0 to prevent oid_object_info_extended() from fetching missing
1667
extern int fetch_if_missing;
1668
1669
/* Dumb servers support */
1670
-extern int update_server_info(int);
1670
+int update_server_info(int);
1671
1672
-extern const char *get_log_output_encoding(void);
1673
-extern const char *get_commit_output_encoding(void);
1672
+const char *get_log_output_encoding(void);
1673
+const char *get_commit_output_encoding(void);
1674
1675
/*
1676
* This is a hack for test programs like test-dump-untracked-cache to
1679
*/
1680
extern int ignore_untracked_cache_config;
1681
1682
-extern int committer_ident_sufficiently_given(void);
1683
-extern int author_ident_sufficiently_given(void);
1682
+int committer_ident_sufficiently_given(void);
1683
+int author_ident_sufficiently_given(void);
1684
1685
extern const char *git_commit_encoding;
1686
extern const char *git_log_output_encoding;
1688
extern const char *git_mailmap_blob;
1689
1690
/* IO helper functions */
1691
-extern void maybe_flush_or_die(FILE *, const char *);
1691
+void maybe_flush_or_die(FILE *, const char *);
1692
__attribute__((format (printf, 2, 3)))
1693
extern void fprintf_or_die(FILE *, const char *fmt, ...);
1694
1695
#define COPY_READ_ERROR (-2)
1696
#define COPY_WRITE_ERROR (-3)
1697
-extern int copy_fd(int ifd, int ofd);
1698
-extern int copy_file(const char *dst, const char *src, int mode);
1699
-extern int copy_file_with_time(const char *dst, const char *src, int mode);
1697
+int copy_fd(int ifd, int ofd);
1698
+int copy_file(const char *dst, const char *src, int mode);
1699
+int copy_file_with_time(const char *dst, const char *src, int mode);
1700
1701
-extern void write_or_die(int fd, const void *buf, size_t count);
1702
-extern void fsync_or_die(int fd, const char *);
1701
+void write_or_die(int fd, const void *buf, size_t count);
1702
+void fsync_or_die(int fd, const char *);
1703
1704
-extern ssize_t read_in_full(int fd, void *buf, size_t count);
1705
-extern ssize_t write_in_full(int fd, const void *buf, size_t count);
1706
-extern ssize_t pread_in_full(int fd, void *buf, size_t count, off_t offset);
1704
+ssize_t read_in_full(int fd, void *buf, size_t count);
1705
+ssize_t write_in_full(int fd, const void *buf, size_t count);
1706
+ssize_t pread_in_full(int fd, void *buf, size_t count, off_t offset);
1707
1708
static inline ssize_t write_str_in_full(int fd, const char *str)
1709
{
1714
* Open (and truncate) the file at path, write the contents of buf to it,
1715
* and close it. Dies if any errors are encountered.
1716
*/
1717
-extern void write_file_buf(const char *path, const char *buf, size_t len);
1717
+void write_file_buf(const char *path, const char *buf, size_t len);
1718
1719
/**
1720
* Like write_file_buf(), but format the contents into a buffer first.
1727
extern void write_file(const char *path, const char *fmt, ...);
1728
1729
/* pager.c */
1730
-extern void setup_pager(void);
1731
-extern int pager_in_use(void);
1730
+void setup_pager(void);
1731
+int pager_in_use(void);
1732
extern int pager_use_color;
1733
-extern int term_columns(void);
1734
-extern int decimal_width(uintmax_t);
1735
-extern int check_pager_config(const char *cmd);
1736
-extern void prepare_pager_args(struct child_process *, const char *pager);
1733
+int term_columns(void);
1734
+int decimal_width(uintmax_t);
1735
+int check_pager_config(const char *cmd);
1736
+void prepare_pager_args(struct child_process *, const char *pager);
1737
1738
extern const char *editor_program;
1739
extern const char *askpass_program;
1777
/* All WS_* -- when extended, adapt diff.c emit_symbol */
1778
#define WS_RULE_MASK 07777
1779
extern unsigned whitespace_rule_cfg;
1780
-extern unsigned whitespace_rule(struct index_state *, const char *);
1781
-extern unsigned parse_whitespace_rule(const char *);
1782
-extern unsigned ws_check(const char *line, int len, unsigned ws_rule);
1783
-extern void ws_check_emit(const char *line, int len, unsigned ws_rule, FILE *stream, const char *set, const char *reset, const char *ws);
1784
-extern char *whitespace_error_string(unsigned ws);
1785
-extern void ws_fix_copy(struct strbuf *, const char *, int, unsigned, int *);
1786
-extern int ws_blank_line(const char *line, int len, unsigned ws_rule);
1780
+unsigned whitespace_rule(struct index_state *, const char *);
1781
+unsigned parse_whitespace_rule(const char *);
1782
+unsigned ws_check(const char *line, int len, unsigned ws_rule);
1783
+void ws_check_emit(const char *line, int len, unsigned ws_rule, FILE *stream, const char *set, const char *reset, const char *ws);
1784
+char *whitespace_error_string(unsigned ws);
1785
+void ws_fix_copy(struct strbuf *, const char *, int, unsigned, int *);
1786
+int ws_blank_line(const char *line, int len, unsigned ws_rule);
1787
#define ws_tab_width(rule) ((rule) & WS_TAB_WIDTH_MASK)
1788
1789
/* ls-files */
1853
* Should we print an ellipsis after an abbreviated SHA-1 value
1854
* when doing diff-raw output or indicating a detached HEAD?
1855
*/
1856
-extern int print_sha1_ellipsis(void);
1856
+int print_sha1_ellipsis(void);
1857
1858
/* Return 1 if the file is empty or does not exists, 0 otherwise. */
1859
-extern int is_empty_or_missing_file(const char *filename);
1859
+int is_empty_or_missing_file(const char *filename);
1860
1861
#endif /* CACHE_H */