diff mbox series

[03/13] spaces and errors fix Handled git pipeline errors

Message ID e31be0d764f47c21519016729259f8d74a53e21f.1699871056.git.gitgitgadget@gmail.com (mailing list archive)
State New, archived
Headers show
Series Enabling z/OS workflow for git | expand

Commit Message

Haritha D Nov. 13, 2023, 10:24 a.m. UTC
From: Haritha D <harithamma.d@ibm.com>

This PR has fixes to enable build on z/OS

Signed-off-by: Harithamma D <harithamma.d@ibm.com>
---
 builtin/hash-object.c |  6 +++---
 convert.c             | 22 +++++++++++++++++-----
 entry.c               | 22 +++++++++++-----------
 object-file.c         |  6 +++---
 4 files changed, 34 insertions(+), 22 deletions(-)

Comments

Junio C Hamano Nov. 14, 2023, 12:38 a.m. UTC | #1
"Haritha D via GitGitGadget" <gitgitgadget@gmail.com> writes:

> Subject: Re: [PATCH 03/13] spaces and errors fix Handled git pipeline errors

-ECANNOTPARSE.  Perhaps Documentation/CodingGuidelines and
 Documentation/SubmittingPatches may help?

> From: Haritha D <harithamma.d@ibm.com>
>
> This PR has fixes to enable build on z/OS

This is way under-explained.  Your proposed log message should be
able to answer when somebody asks "Is anything broken in the
existing codebase to cause your build to fail, or is it your
compiler toolchain that is broken?" but the above does not help
understanding what and why you needed to fix at all.

> diff --git a/builtin/hash-object.c b/builtin/hash-object.c
> index b33b32ff977..9129658a37c 100644
> --- a/builtin/hash-object.c
> +++ b/builtin/hash-object.c
> @@ -62,8 +62,8 @@ static void hash_fd(int fd, const char *type, const char *path, unsigned flags,
>  #  include <stdio.h>
>  #  include <stdlib.h>
>  
> -   int setbinaryfd(int fd)
> -   {
> +int setbinaryfd(int fd)
> +{
>       attrib_t attr;
>       int rc;
>  
> @@ -74,7 +74,7 @@ static void hash_fd(int fd, const char *type, const char *path, unsigned flags,
>  
>       rc = __fchattr(fd, &attr, sizeof(attr));
>       return rc;
> -   }
> +}
>  #  endif
>  #endif

No such function in our codebase.  Are you fixing somebody else's
forked version of Git and we shouldn't even be looking at this
patch, perhaps?

> diff --git a/convert.c b/convert.c
> index 4f14ff6f1ed..17cc849efed 100644
> --- a/convert.c
> +++ b/convert.c
> @@ -1315,15 +1315,28 @@ static struct attr_check *check;
>  
>  static const char* get_platform() {
>  	struct utsname uname_info;
> +	char *result;
> +	if(!uname_info.sysname)
> +	{
> +		result = (char *)malloc(strlen(uname_info.sysname)+1);
> +		int index=0;
> +		while(index <= strlen(uname_info.sysname))
> +		{
> +			*result = uname_info.sysname[index];
> +			++result;
> +			++index;
> +		}
> +	}

No such function in our codebase.  I doubt these patches have much
relevance to this project?

I'll stop here.
diff mbox series

Patch

diff --git a/builtin/hash-object.c b/builtin/hash-object.c
index b33b32ff977..9129658a37c 100644
--- a/builtin/hash-object.c
+++ b/builtin/hash-object.c
@@ -62,8 +62,8 @@  static void hash_fd(int fd, const char *type, const char *path, unsigned flags,
 #  include <stdio.h>
 #  include <stdlib.h>
 
-   int setbinaryfd(int fd)
-   {
+int setbinaryfd(int fd)
+{
      attrib_t attr;
      int rc;
 
@@ -74,7 +74,7 @@  static void hash_fd(int fd, const char *type, const char *path, unsigned flags,
 
      rc = __fchattr(fd, &attr, sizeof(attr));
      return rc;
-   }
+}
 #  endif
 #endif
 
diff --git a/convert.c b/convert.c
index 4f14ff6f1ed..17cc849efed 100644
--- a/convert.c
+++ b/convert.c
@@ -1315,15 +1315,28 @@  static struct attr_check *check;
 
 static const char* get_platform() {
 	struct utsname uname_info;
+	char *result;
+	if(!uname_info.sysname)
+	{
+		result = (char *)malloc(strlen(uname_info.sysname)+1);
+		int index=0;
+		while(index <= strlen(uname_info.sysname))
+		{
+			*result = uname_info.sysname[index];
+			++result;
+			++index;
+		}
+	}
 
 	if (uname(&uname_info))
 		die(_("uname() failed with error '%s' (%d)\n"),
 			    strerror(errno),
 			    errno);
 
-  if (!strcmp(uname_info.sysname, "OS/390"))
-    return "zos";
-  return uname_info.sysname;
+	if (!strcmp(uname_info.sysname, "OS/390"))
+		result="zos";
+
+	return result;
 }
 
 
@@ -1331,11 +1344,10 @@  void convert_attrs(struct index_state *istate,
 		   struct conv_attrs *ca, const char *path)
 {
 	struct attr_check_item *ccheck = NULL;
-  struct strbuf platform_working_tree_encoding = STRBUF_INIT;
+	struct strbuf platform_working_tree_encoding = STRBUF_INIT;
 
 	strbuf_addf(&platform_working_tree_encoding, "%s-working-tree-encoding", get_platform());
 
-
 	if (!check) {
 		check = attr_check_initl("crlf", "ident", "filter",
 					 "eol", "text", "working-tree-encoding", platform_working_tree_encoding.buf,
diff --git a/entry.c b/entry.c
index df6feb2234b..f2a7b2adbf5 100644
--- a/entry.c
+++ b/entry.c
@@ -130,17 +130,17 @@  int fstat_checkout_output(int fd, const struct checkout *state, struct stat *st)
 void tag_file_as_working_tree_encoding(struct index_state *istate, char* path, int fd) {
 	struct conv_attrs ca;
 	convert_attrs(istate, &ca, path);
-  if (ca.attr_action != CRLF_BINARY) {
-    if (ca.working_tree_encoding)
-      __chgfdcodeset(fd, ca.working_tree_encoding);
-    else
-      __setfdtext(fd);
-  }
-  else {
-    __setfdbinary(fd);
-  }
-
-  __disableautocvt(fd);
+	if (ca.attr_action != CRLF_BINARY) {
+		if (ca.working_tree_encoding)
+			__chgfdcodeset(fd, ca.working_tree_encoding);
+		else
+			__setfdtext(fd);
+	}
+	else {
+		__setfdbinary(fd);
+	}
+
+	__disableautocvt(fd);
 }
 #endif
 
diff --git a/object-file.c b/object-file.c
index 28e69ed1e33..562d1344422 100644
--- a/object-file.c
+++ b/object-file.c
@@ -2557,15 +2557,15 @@  int index_path(struct index_state *istate, struct object_id *oid,
 	switch (st->st_mode & S_IFMT) {
 	case S_IFREG:
 #ifdef __MVS__
-    validate_codeset(istate, path, &autocvtToASCII);
+	validate_codeset(istate, path, &autocvtToASCII);
 #endif
 		fd = open(path, O_RDONLY);
 		if (fd < 0)
 			return error_errno("open(\"%s\")", path);
 
 #ifdef __MVS__
-   if (!autocvtToASCII)
-     __disableautocvt(fd);
+	if (!autocvtToASCII)
+		__disableautocvt(fd);
 #endif
 
 		if (index_fd(istate, oid, fd, st, OBJ_BLOB, path, flags) < 0)