git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: "Haritha D via GitGitGadget" <gitgitgadget@gmail.com>
To: git@vger.kernel.org
Cc: Haritha  <harithamma.d@ibm.com>, Haritha D <harithamma.d@ibm.com>
Subject: [PATCH 03/13] spaces and errors fix Handled git pipeline errors
Date: Mon, 13 Nov 2023 10:24:05 +0000	[thread overview]
Message-ID: <e31be0d764f47c21519016729259f8d74a53e21f.1699871056.git.gitgitgadget@gmail.com> (raw)
In-Reply-To: <pull.1537.git.git.1699871056.gitgitgadget@gmail.com>

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(-)

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)
-- 
gitgitgadget



  parent reply	other threads:[~2023-11-13 10:24 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-13 10:24 [PATCH 00/13] Enabling z/OS workflow for git Haritha  via GitGitGadget
2023-11-13 10:24 ` [PATCH 01/13] " Haritha D via GitGitGadget
2023-11-13 10:24 ` [PATCH 02/13] Enable builds for z/OS Haritha D via GitGitGadget
2023-11-13 23:03   ` brian m. carlson
2023-11-14  1:47     ` Junio C Hamano
2023-11-14  0:48   ` Junio C Hamano
2023-11-13 10:24 ` Haritha D via GitGitGadget [this message]
2023-11-14  0:38   ` [PATCH 03/13] spaces and errors fix Handled git pipeline errors Junio C Hamano
2023-11-13 10:24 ` [PATCH 04/13] fixes for build errors Handled git pipeline errorse Haritha D via GitGitGadget
2023-11-13 10:24 ` [PATCH 05/13] fixes for build errors Haritha D via GitGitGadget
2023-11-13 10:24 ` [PATCH 06/13] spaces and errors fix Handled git pipeline errors Haritha D via GitGitGadget
2023-11-13 10:24 ` [PATCH 07/13] " Haritha D via GitGitGadget
2023-11-13 10:24 ` [PATCH 08/13] platform_name " Haritha D via GitGitGadget
2023-11-13 10:24 ` [PATCH 09/13] strncpy " Haritha D via GitGitGadget
2023-11-13 10:24 ` [PATCH 10/13] " Haritha D via GitGitGadget
2023-11-13 10:24 ` [PATCH 11/13] " Haritha D via GitGitGadget
2023-11-13 10:24 ` [PATCH 12/13] Handled git pipeline errors - Memory leak Haritha D via GitGitGadget
2023-11-13 10:24 ` [PATCH 13/13] Handled git pipeline errors - z/OS enable Haritha D via GitGitGadget
2023-12-04 14:19 ` [PATCH v2] This PR enables a successful git build on z/OS Haritha  via GitGitGadget
2023-12-04 21:46   ` Eric Sunshine
2023-12-05 20:58     ` René Scharfe

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=e31be0d764f47c21519016729259f8d74a53e21f.1699871056.git.gitgitgadget@gmail.com \
    --to=gitgitgadget@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=harithamma.d@ibm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).