Skip to content

Commit 219c185

Browse files
author
Git for Windows Build Agent
committed
Merge pull request #866 from landstander668/add_platform
Add reporting of build platform
2 parents 424d04f + 1f954ff commit 219c185

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed

help.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -423,6 +423,8 @@ const char *help_unknown_cmd(const char *cmd)
423423

424424
int cmd_version(int argc, const char **argv, const char *prefix)
425425
{
426+
static char build_platform[] = GIT_BUILD_PLATFORM;
427+
426428
/*
427429
* The format of this string should be kept stable for compatibility
428430
* with external projects that rely on the output of "git version".
@@ -431,6 +433,7 @@ int cmd_version(int argc, const char **argv, const char *prefix)
431433
while (*++argv) {
432434
if (!strcmp(*argv, "--build-options")) {
433435
printf("sizeof-long: %d\n", (int)sizeof(long));
436+
printf("machine: %s\n", build_platform);
434437
/* NEEDSWORK: also save and output GIT-BUILD_OPTIONS? */
435438
}
436439
}

help.h

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,3 +33,16 @@ extern void list_commands(unsigned int colopts, struct cmdnames *main_cmds, stru
3333
*/
3434
extern void help_unknown_ref(const char *ref, const char *cmd, const char *error);
3535
#endif /* HELP_H */
36+
37+
/*
38+
* identify build platform
39+
*/
40+
#ifndef GIT_BUILD_PLATFORM
41+
#if defined __x86__ || defined __i386__ || defined __i586__ || defined __i686__
42+
#define GIT_BUILD_PLATFORM "x86";
43+
#elif defined __x86_64__
44+
#define GIT_BUILD_PLATFORM "x86_64";
45+
#else
46+
#define GIT_BUILD_PLATFORM "unknown";
47+
#endif
48+
#endif

0 commit comments

Comments
 (0)